Cryptographically Secure Random
Cryptographically secure random refers to random number generation (RNG) methods that produce unpredictable and statistically random outputs suitable for security-critical applications, such as encryption keys, tokens, and cryptographic protocols. It ensures that the generated values cannot be practically predicted or reproduced by an attacker, even with knowledge of previous outputs or system state. This is typically implemented through cryptographically secure pseudorandom number generators (CSPRNGs) that use entropy sources like hardware events or system noise.
Developers should use cryptographically secure random when generating data for security-sensitive operations, such as creating encryption keys, session tokens, passwords, nonces, or initialization vectors in cryptographic systems. It is essential in applications like web security (e.g., CSRF tokens), blockchain (e.g., private keys), and secure communications to prevent attacks like brute-force or prediction-based exploits. Using non-cryptographic random generators in these contexts can lead to vulnerabilities and data breaches.