liveBook · Manning

Cryptographically secure random number generator

As explained in Real-World Cryptography

A cryptographically secure pseudorandom number generator is a pseudorandom number generator whose outputs are computationally indistinguishable from uniform random values and whose state resists recovery from observed outputs.

When unpredictable randomness is slow, an operating system can use a cryptographically secure pseudorandom number generator (CSPRNG) to produce many security-sensitive values quickly from a secret seed. The seed combines entropy sources; the generator then expands it deterministically. section 8.2

A secure generator should provide these properties:

  • Determinism: reusing a seed reproduces the same sequence, making the generator predictable to someone who knows the seed. section 8.2
  • Random-looking output: observed values should be computationally indistinguishable from uniformly chosen values and should not reveal the internal state. section 8.2
  • Forward and backward secrecy: state compromise should not reveal past values or, after fresh entropy is injected, predict future values. section 8.2
Figure 8.1 A pseudorandom number generator (PRNG) generates a sequence of random numbers based on a seed. Using the same seed makes the PRNG produce the same sequence of random numbers. It should be impossible to recover the state using knowledge of the random outputs (the function next is one way). It follows that it should also be impossible from observing the produced random numbers alone to predict future random numbers or to recover previously generated random numbers.

Follow the seed, state, and next-output flow to see why observing outputs alone should not expose past or future values. section 8.2

How Real-World Cryptography covers it

How deep it goes
Explains seeds, deterministic expansion, uniform indistinguishability, state resistance, and secrecy properties without implementation detail.
Examples
Uses a seed-to-sequence diagram and contrasts observed outputs with uniform choices.
What you can do after
Evaluate/understand when a fast pseudorandom generator can replace slow entropy collection for security randomness.
How it connects
Connects entropy, pseudorandom number generators, deterministic random bit generators, forward secrecy, and backward secrecy.

Also explained in

Compare how 3 books explain cryptographically secure random number generator →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Real-World Cryptography. The section links point to the parts of the book it draws on.