Random Number Generation
Random number generation (RNG) is crucial in cryptography, providing unpredictable values for keys, nonces, and salts. Poor randomness weakens security. This article explores RNG types, their crypto role, methods, and applications.
Types of RNG
- PRNG (Pseudo-Random Number Generator): Algorithmic, deterministic (e.g., Linear Congruential Generator: \( X_{n+1} = (aX_n + c) \mod m \)).
- TRNG (True Random Number Generator): Uses physical phenomena (e.g., thermal noise).
Crypto prefers TRNG or cryptographically secure PRNGs (CSPRNGs).
Role in Cryptography
Randomness ensures:
- Key Generation: Unpredictable keys in AES or RSA.
- Nonces: Unique values prevent replay attacks.
- Salts: Randomize hashes for password security.
Weak RNG (e.g., Debian OpenSSL 2008 flaw) compromises systems.
Generation Methods
- PRNG Example: \( X_{n+1} = (5X_n + 3) \mod 16 \), seed \( X_0 = 1 \): 1, 8, 11, 10, … (repeats).
- CSPRNG: Fortuna, uses entropy pools.
- TRNG: Hardware like Intel’s RdRand or quantum devices.
CSPRNGs balance speed and security.
Applications
RNG is used in:
- Cryptography: SSL/TLS key generation.
- Gaming: Fair dice rolls, card shuffles.
- Simulation: Monte Carlo methods.
It’s the bedrock of secure and fair systems.