CSPRNG

acronym

cryptographyprogramming

Kept in this browser · My desk

Stands for: cryptographically strong pseudo-random number generator

A random number generator whose output cannot be predicted from earlier output, suitable for keys, tokens, salts and nonces; PEP 506 defines it as resistant to prediction.

Python's random module uses the Mersenne Twister, which its documentation calls completely deterministic and completely unsuitable for cryptographic purposes. The secrets module, added in Python 3.6 by PEP 506, and os.urandom() draw on the operating system's most secure source instead; secrets.token_bytes(), token_hex() and token_urlsafe() default to 32 bytes today, a value the documentation says may change.

Also known as: cryptographically secure pseudorandom number generator, secrets module, os.urandom

← Back to C Back to the glossary