There are three very different things that people call "random numbers," and confusing them has caused real disasters.
1. Pseudorandom (PRNG)
A PRNG like the Mersenne Twister (Matsumoto & Nishimura, 1998) passes every standard statistical test â chi-square, autocorrelation, the TestU01 suite. Its period is 219937 â 1. Yet it is entirely deterministic. After observing just 624 consecutive 32-bit outputs, an attacker can fully reconstruct the internal state and predict all future values. Python's random, PHP's mt_rand and Java's Random all use it.
2. Cryptographically secure (CSPRNG)
A CSPRNG must pass the next-bit test: no polynomial-time algorithm should predict the next bit with probability significantly better than 1/2, assuming standard hardness conjectures. Examples: ChaCha20-based generators (Linux /dev/urandom, Windows BCryptGenRandom), HMAC-DRBG (NIST SP 800-90A). Even if you see all previous outputs, the next bit looks genuinely unpredictable.
3. True randomness
Physical entropy â thermal noise, radioactive decay, quantum shot noise â is the only source of actual unpredictability. Devices like /dev/random harvest it; dedicated hardware ICs (Intel RDRAND) sample chip-level noise. True entropy is precious and rate-limited; it seeds CSPRNGs rather than generating output directly.
Where things go wrong
Real failures happen at the boundary. In 2012, researchers found that millions of RSA and DSA public keys generated by embedded devices shared prime factors â the devices had too little entropy at boot time, so their "random" seeds collided. The keys looked different but were mathematically related. The attack, called ROCA (Return of Coppersmith's Attack), compromised smart cards, TPMs and VPN appliances worldwide.
The Debian OpenSSL bug (2006â2008) accidentally replaced a genuine entropy source with a predictable process ID â reducing the PRNG seed space to just 32,768 values. Every "secure" key generated on Debian during those two years could be brute-forced in seconds.
Related reading: the unpredictability requirements here connect directly to factoring and discrete logarithms, the hard problems that underpin most public-key cryptography.
Comments
Loading comments...