Counting what
you don't know
Shannon gave uncertainty a number. Entropy measures how surprising a source is — how many bits of genuine unknowing it holds. It's why the one-time pad can achieve perfect secrecy, and why predictable passwords are vulnerable to guessing. Guessing cost also depends on the password distribution, derivation function and attack setting.
Bits of the unknown
A fair coin holds exactly one bit of entropy: two outcomes, equally likely. Bias the coin and the entropy drops — a coin that's 90% heads barely surprises you. Drag the bias and watch the entropy fall from its peak.
Key length under a uniform model
These bars assume each character is selected independently and uniformly from the stated alphabet. Under that model, entropy is length × log₂(alphabet size). Human-chosen passwords do not generally follow this model: length and character variety alone do not determine resistance to guessing.
A flat histogram can hide a pattern
Write A–Z in order 100 times. Each letter occurs 100 times, yet the next letter is completely predictable. The workbench reports an index of coincidence (IC) rounded to 0.0381. The exact value is 26 × 100 × 99 / (2600 × 2599). Rearranging those same letters preserves the histogram and IC. Neither statistic measures their order.
To discuss entropy, specify a source distribution. In the cyclic source below, choose one of the 26 starting letters uniformly once, then continue around the alphabet forever. Compare that with choosing a fresh independent uniform letter at every position. Here n is a positive block length.
| Declared source | One position | Whole n-letter block | Entropy rate |
|---|---|---|---|
| One random cyclic phase | log₂ 26 ≈ 4.7004 bits | log₂ 26 bits: only 26 possible blocks | 0 bits per letter in the limit |
| Independent uniform letters | log₂ 26 ≈ 4.7004 bits | n log₂ 26 bits: 26ⁿ possible blocks | log₂ 26 bits per letter |
Entropy rate is the limiting block entropy divided by block length. For the cyclic source, 4.7004/n tends to zero: learning the first letter determines the rest. These are properties of the declared sources, not entropy estimates for a particular observed string.
Robert M. Gray, Entropy and Information Theory, corrected first edition, 26 June 2023 (original 1990), §2.2, printed pp.18–20, and §2.6, printed p.42. The alphabet/IC comparison is our worked application of the distinction between marginal and sequence entropy. Continue with Crypto Lab’s Good Randomness for deeper randomness experiments.
For a conditional-distribution control, try the exact OTP secrecy experiment: uniform plaintext can give a flat ciphertext histogram even with a biased pad. Compare the chosen prior, posterior and pairwise ciphertext distance; the same page enumerates why two individually hidden messages can leak jointly when a pad is reused.
Average uncertainty versus the first guess
Shannon entropy averages surprise across outcomes. Min-entropy asks about the most likely outcome: Hmin = −log₂(Pbest), where Pbest is the success probability of the best single guess. Neither specifies the cost of testing a guess.
Consider an n-bit source that outputs the all-zero string with probability a, and otherwise draws a uniform n-bit string. The uniform branch can also produce zeros, so Pbest = a + (1−a)/2ⁿ. Each other string has probability q = (1−a)/2ⁿ. Its exact Shannon entropy is −Pbest log₂ Pbest − (2ⁿ−1)q log₂ q, with 0 log₂ 0 treated as zero.
| Source | Shannon entropy | Best first guess | Min-entropy |
|---|---|---|---|
| Uniform (a = 0) | 256 bits | Success 2⁻²⁵⁶ | 256 bits |
| Mixture (a = 1/2) | Approximately 129 bits | Guess all zeros: success 1/2 + 2⁻²⁵⁷ | Approximately 1 bit |
The mixture has substantial average uncertainty, yet one guess succeeds about half the time. This is a constructed distribution, not a measured password population; 2 raised to the Shannon entropy is not a “guesses required” formula. Deterministic hashing cannot manufacture missing source entropy.
Adapted from Salil P. Vadhan, Pseudorandomness, Foundations and Trends in Theoretical Computer Science 7(1–3), volume dated 2011, copyright 2012, §6.1.2, printed pp.171–172 (Definition 6.7 and Lemma 6.8). Vadhan uses a .99/.01 mixture; the half-and-half values here are our teaching preset. Crypto Lab’s Noise to Numbers offers a deeper exploration of randomness sources.
A shorter secret after partial leakage
Alice and Bob share two independent fair bits X₁ and X₂. An observer learns one bit and which position it came from; choose that position independently and fairly. Alice and Bob do not know which position leaked. Their shared output K = X₁ XOR X₂ is still a fair secret bit under this specific leakage model.
| X₁X₂ | Revealed position | Observed bit | K = parity |
|---|---|---|---|
| 00 | 1 | 0 | 0 |
| 00 | 2 | 0 | 0 |
| 01 | 1 | 0 | 1 |
| 01 | 2 | 1 | 1 |
| 10 | 1 | 1 | 1 |
| 10 | 2 | 0 | 1 |
| 11 | 1 | 1 | 0 |
| 11 | 2 | 1 | 0 |
Group rows by what the observer knows: (position, observed bit). Every group contains one K = 0 and one K = 1. Thus K is uniform and independent of that observation. For example, seeing position 1 equal to 0 leaves 00 and 01 equally likely, giving opposite parities.
Negative control: leak parity instead. If the observer learns X₁ XOR X₂, the proposed output K is completely known: their first guess succeeds with probability 1. XOR does not remove arbitrary leakage.
Privacy amplification aims to obtain a shorter, almost-uniform secret independent of the observer’s side information and the public extractor choice. The guarantees depend on the joint source/leakage model and remaining uncertainty. This fixed table enumerates a model; it generates no operational secret keys.
Himanshu Tyagi and Shun Watanabe, Information-theoretic Cryptography, Cambridge University Press, 2023, §7.3, printed p.124, Example 7.9 and Definition 7.10; pp.125–127 develop conditional min-entropy and Theorem 7.13. The leaked-parity control is our contrasting example. See also the XOR glossary entry.
Pooling many keys measures the collection, not the message
Research datasets of homophonic ciphers are built by encrypting many plaintexts, each under a key generated independently for it. Measure the entropy of all that ciphertext together and you get a large number. It is easy to read that number as a statement about how well any one message is hidden. It is not.
Here is a fully enumerable case. Three plaintext letters A, B, C; two homophones each; sixty letters per message, with the three letters equally frequent and the two homophones alternating evenly. Four independent keys draw their code symbols from disjoint inventories, so no symbol is shared.
| What is measured | Distinct code symbols | Entropy per code symbol |
|---|---|---|
| One message under one fixed key | 6 | log₂ 6 = 2.5850 bits |
| All four messages pooled | 24 | log₂ 24 = 4.5850 bits |
The pooled figure is exactly 2 bits higher: log₂ 4 = 2 bits is the information needed to distinguish four equally likely keys. Nothing about any single message changed. An attacker holding one of these messages still faces a three-letter cipher with six code symbols; the extra two bits only record which of the four keys a symbol came from, which is not a secret the message is keeping.
The bound for a realistic size. Take the usual research setting: 26 plaintext letters, at most five homophones for each. One fixed key then has at most 26 × 5 = 130 code types, so the entropy of its code-symbol distribution is at most log₂ 130 ≈ 7.022 bits per symbol — and only if all 130 were equally likely, which proportional homophone allocation never quite achieves. A pooled alphabet of eleven thousand codes gives log₂ 11000 ≈ 13.425 bits, almost double. That larger number is a property of the collection, not of the cipher a reader of one letter is facing.
Status of this example: a mathematical consequence of the stated model, worked and checked here. It is not a replication of any published dataset measurement, and it does not say a published pooled figure is wrong — a pooled statistic is simply a different statistic, and it cannot establish per-message uniformity or security.
Unicity distance answers a narrower question than it looks
Shannon’s unicity distance estimates how much ciphertext is needed before only one key is expected to yield a sensible plaintext. It is an expectation computed from two assumptions: the size of the key space, and the redundancy of the plaintext language. Change either assumption and the estimate changes.
Three things it does not do.
- It does not certify a proposed reading. The estimate says spurious readings become unlikely past some length. It says nothing about whether the particular reading in front of you is the right one. That still needs evidence outside the cipher: corroborating documents, the archive, the hand, the history.
- It does not promise an efficient solver. A unique solution can exist and remain out of reach. Unicity is an information-theoretic count of how many keys survive, not a statement about the work of finding the survivor.
- It does not cover alternative systems. The calculation fixes a cipher family and a key space. It cannot rule out that some different enciphering scheme also produces readable text.
The published analysis of the Zodiac 340 cipher makes the dependence visible: its author computes the plaintext-language entropy under three different assumptions — standard English, the Z340 plaintext alone, and Zodiac’s whole correspondence — and reports the resulting unicity distance as a range, at most 152 characters, rather than a single figure.
A rule that follows from both sections. Enlarging the pooled code alphabet changes a dataset statistic. It does not make any individual message easier or harder to recover, and a cryptanalytic result that improves when the pool grows is measuring the pool, not the cipher. The museum’s research-evaluation v2 keeps those tasks apart for exactly this reason.
Micaella Bruton, Meriem Beloucif and Beáta Megyesi, “Bridging the Low Resource Gap in Historical Cryptology: A Multilingual Diachronic Synthetic Dataset for Reproducible Cryptanalysis,” RESOURCEFUL 2026, pp. 13–24: independently generated per-text homophonic keys. Joachim von zur Gathen, “Unicity distance of the Zodiac-340 cipher,” ePrint 2021/1620 (Cryptologia 47(5), 2023): the three language-entropy assumptions and the resulting range. Continue with the homophonic exhibit and the Evidence Workbench.
The one-time pad's perfect secret
A pad chosen uniformly and independently of the message, kept secret, as long as the message and used once provides perfect secrecy for fixed-length messages. Entropy is part of that argument, but a high-entropy string that is public or related to the message is not a secure pad.
Uncertainty and attack cost
The One-Time Pad’s perfect secrecy is this measure made physical. A cipher fed a predictable key can be vulnerable to searches over likely candidates, with cost depending on how candidates can be tested. Entropy is why the random number generator matters as much as the cipher.
Security bits estimate attack cost under a specified model; they are not the same quantity as Shannon entropy. AES-128 has a 128-bit key space and is intended to provide roughly 128-bit classical security. A suitable 256-bit elliptic-curve group has generic discrete-log attacks costing roughly 2¹²⁸ group operations. A source's Shannon entropy alone does not specify its password-guessing cost or a scheme's computational security.
Where the ceiling is reached: the One-Time Pad uses one independently uniform secret key bit per message bit in the binary construction. Vernam’s 1917 combining machine supplies a mechanical precursor; its security depends on the tape, and a repeating tape is not a one-time pad.