CSPRNG
A cryptographically secure pseudorandom number generator: a source of random numbers that attackers cannot predict, used to create keys, nonces and salts.
In more detail
CSPRNG stands for cryptographically secure pseudorandom number generator. Operating systems provide one, seeded from hardware noise, and programming languages expose it through calls such as Python's secrets module or os.urandom. Ordinary random functions, such as Python's random module, are predictable and must never be used for security values.
Examples
secrets.token_bytes(32)salts: use os.urandom(16) per useropenssl rand -hex 32 > db.keyRelated terms
- random seed — The starting value of a pseudo-random number generator; the same seed always produces the same sequence of numbers.
- encryption key — A secret value that an encryption algorithm uses to scramble and unscramble data, so that only holders of the right key can read it.
- nonce — A value meant to be used only once, such as a unique number given to a cipher or a random token that marks trusted scripts in a web page.
- salt — An extra value mixed into data before hashing so that otherwise identical inputs produce different hashes.
Taught in
- Symmetric Encryption: AES-GCM & ChaCha20 — Cybersecurity Fundamentals, GRC & Cryptography
- Cryptographic Hashing: SHA-256, SHA-3 & Passwords — Cybersecurity Fundamentals, GRC & Cryptography
- Post-Quantum Cryptography & Key Lifecycles — Cybersecurity Fundamentals, GRC & Cryptography