liveBook · Manning

Entropy

As explained in Real-World Cryptography

Entropy is a measure of the uncertainty or unpredictability contained in a random source or secret.

Entropy measures how much randomness a byte string contains. High-entropy values are uniformly random and difficult to guess; low-entropy values are predictable. Cryptographic systems need enough entropy to create secrets such as keys. section 8.9

A typical operating system gathers noise from multiple sources, mixes that entropy, and uses it to seed a long-term pseudorandom number generator (PRNG). The PRNG can then produce a practical supply of random-looking values. section 8.3

Treat entropy as a security dependency, not merely a property of an API:

  • Prefer a programming language’s standard library or a recognized cryptographic randomness library. section 8.3
  • Avoid predictable general-purpose generators, such as PHP rand or a non-cryptographic random package. section 8.3
  • Handle early boot carefully: /dev/urandom may be predictable before sufficient entropy has accumulated, while getrandom can wait for proper seeding. section 8.3 section 8.4
  • Check forked processes, cloned virtual machines, and embedded devices for reused PRNG state or repeated seeds. section 8.4

Choosing a random-byte source

Reading 16 bytes from /dev/urandom can produce a secret on Unix-like systems, while C can call getrandom and PHP can use random_bytes(16). The similarly convenient rand function is not suitable for cryptographic secrets. section 8.3

Figure 8.4 Generating random numbers on a system usually means that entropy was mixed together from different noise sources and used to seed a long-term PRNG.

A system-level diagram shows how noise sources are combined into entropy and used to seed a long-term PRNG. section 8.3

How Real-World Cryptography covers it

How deep it goes
Defines high and low entropy, then follows randomness through OS seeding, APIs, and early-boot failure modes.
Examples
Uses /dev/urandom, getrandom, BCryptGenRandom, PHP random_bytes, and predictable random generators as contrasts.
What it assumes
Assumes basic familiarity with random numbers and byte strings while defining entropy and uniform selection directly.
What you can do after
Operate/configure secure randomness through standard libraries or suitable operating-system interfaces.
How it connects
Connects entropy with PRNGs, cryptographic libraries, key derivation functions, and secret management.

Also explained in

Compare how 13 books explain entropy →

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.