Kayavak / Information Theory / IT·10 Information Everywhere: Language, DNA, Randomness and Passwords / Deeper
Deeper · Information Theory
Information Everywhere: Language, DNA, Randomness and Passwords
The questions the chapter doesn't stop for: why this exists, the model to keep in your head, what changes when an assumption does, how sure we are of each claim, and what's still open. Read it after the chapter; back to the chapter.
Why does this exist?
Shannon's theory gave exact answers for sources whose probabilities are known. Real sources come without labels: nobody knows the probability of an English sentence, a stretch of DNA or a password. So the theory had to become a measurement science, with its own instruments (models, compressors, guessing games) and its own pitfalls (bias, overfitting, the wrong alphabet). Shannon started it himself in 1951 by measuring English with human guessers, and the question "how much information is in this?" has since been asked of languages, genomes, music, images, neural signals and financial markets.
Security took the same tools in a different direction. Keys, tokens and passwords are only as strong as they are unpredictable, and the attacks of the 1990s and 2000s (Netscape's time-seeded keys, Debian's 32,767 possible keys, leaked password databases) showed that the average-case entropy of chapter 4 is the wrong measure for secrets. Min-entropy and guess curves became the way to measure them, and password guidance was rewritten around what people actually choose.
The mental model
Try it yourself first: write your own model in the Mental Model Explorer, then compare.
Real sources are measured with models: every model's surprise on unseen data is an upper bound on the information, and better models tighten it. For secrets, the measure is not average surprise but the chance of the best guesses.
| Question | Answer |
|---|---|
| What is it? | Measuring the information in real sources, and in secrets |
| Problem it solves | Estimating entropy without knowing the probabilities; judging how guessable a secret is |
| Parts | Models and cross-entropy, blending, guessing games, min-entropy, secure generators, guess curves |
| How it works | Predict, measure surprise on held-out data; for secrets, rank values by probability |
| Assumptions | Enough data, the right alphabet, held-out testing, a representative sample |
| When they change | Small samples, long tails, scripts with many characters, structure only a specialist model sees |
| Where it fails | Plug-in estimates of long-tailed distributions; formulas that assume random choice when people choose |
| Related ideas | Entropy and its bias (ch04), source coding (ch06), overfitting (ch07), cross-entropy (ch11) |
What if?
What if a model could predict English perfectly?
Reason it through, then open
Then its cross-entropy would equal the entropy rate of English, whatever that is, and compressing text with it would reach the limit. It still wouldn't reach zero: language carries information because what someone will write next is genuinely uncertain, even to a perfect model of the language. Today's large language models report cross-entropies below 1 bit per character on standard benchmarks, consistent with Shannon's 1951 range, and each improvement lowers the upper bound; nobody knows how much lower it can go, because no one can measure the true rate directly.
What if passwords were chosen by machines?
Reason it through, then open
Then their min-entropy would equal their Shannon entropy, and both would be exactly what the generator provides: 52 bits for 4 random words from 7,776, 78 bits for 12 random printable characters. Guess curves would be flat: 1,000 guesses would break 1,000 in accounts, not 11 % of them. That's the argument for password managers and passkeys: they take the choice away from people, whose choices have a min-entropy around 7 bits. The remaining risks are elsewhere: phishing, reuse across sites (which machines also prevent), and theft of the stored secrets.
What if a random number generator's seed leaked?
Reason it through, then open
Then every output would be predictable to whoever has the seed: a deterministic generator is just an expansion of its seed, and its outputs carry no more min-entropy than the seed did, however random they look. That's why secure generators are reseeded continually from fresh noise, why their state is protected like a key, and why generators are designed so that a leaked current state doesn't reveal past outputs ("forward secrecy" for generators). The Debian bug was the extreme case: the seed had about 15 bits, so every key was one of about 32,767.
Where the boundary is
| Aspect | Shannon entropy | Min-entropy |
|---|---|---|
| Measures | Average surprise | Surprise of the most likely value |
| Question answered | How short can descriptions be on average? | How likely is the best single guess? |
| For a uniform distribution | (the same) | |
| One value with probability ½ | Can still be large | 1 bit |
| Estimated from samples | Biased low, badly for long tails | Stable: needs only the top value |
| Used for | Compression, communication | Keys, tokens, passwords, randomness sources |
Derive it
Why a model's cross-entropy can't beat the entropy rate (for a source whose symbols are independent, as a sketch).
- Let the source's true probabilities be and the model's be . The model's average surprise per symbol is , its cross-entropy.
- Subtract the entropy : the difference is .
- Using as in chapter 4: .
- So the model's average surprise is at least the entropy, with equality only when . The difference is the Kullback–Leibler divergence, chapter 11's subject.
- For sources with memory, the same argument applies to each symbol given the past, and the entropy rate takes the entropy's place.
How sure are we?
| Claim | How it's known | Where from |
|---|---|---|
| Every model's cross-entropy on long data is at least the entropy rate | Theorem | The derivation above; chapter 11 |
| English carries roughly 0.6 to 1.3 bits per letter | Measured, with human guessers | Shannon (1951); Cover and King (1978) |
| The blended model reaches 2.13 bits per symbol on the plays | Measured | The chapter's lab |
| Human-chosen passwords have about 7 bits of min-entropy | Measured on one large leak | The chapter's lab; similar in Bonneau (2012) |
| Mersenne Twister output is predictable from 624 values | Mathematical fact, demonstrated | The chapter's lab |
| A third of the chloroplast genome starts a reversed complementary copy | Measured | The chapter's lab |
| Composition rules add little guessing resistance | Measured in studies of real passwords | NIST SP 800-63B's rationale |
Still open
How much information English (or any language) carries per character is still unknown: models keep lowering the upper bound, and good lower bounds are scarce. Comparing languages fairly, on the same content with models of equal quality, is active research, as is whether languages are optimised to carry information at a steady rate (the "uniform information density" hypothesis). For randomness, estimating the min-entropy of physical noise sources reliably, and detecting when they fail, remains hard; for passwords, the open problems are less about measurement than about replacing them.
What would change your mind? The chapter claims that human-chosen passwords have very little min-entropy whatever the rules. A large, representative collection of passwords chosen under some policy, in which the most common password covered, say, less than one account in a million, would refute it for that policy; so far, every large leak has shown a heavy head of common choices.
Recall
Why does every model give an upper bound on a source's entropy rate?
Its surprise on unseen data is the length of a code built from it, and no code beats the entropy rate on average.
What does blending contexts do?
Uses the longest context in proportion to its evidence and fills in from shorter ones, reducing overfitting.
What did Shannon's guessing game estimate for English?
Roughly 0.6 to 1.3 bits per letter with long context.
Why do byte counts mislead when comparing languages?
UTF-8 spends 1 to 4 bytes per character; bytes measure the encoding, not the information.
Why does DNA look random to general compressors?
Its structure (reverse complements, codons, repeats with mutations) isn't the kind they model.
What is min-entropy?
−log₂ of the largest probability: how likely the best single guess is to succeed.
Why is Python's random module unsafe for secrets?
Its state can be recovered from 624 outputs, so future outputs can be predicted.
How many accounts fell to the 1,000 most common passwords in the lab?
11.30 %.
Reflect
Be honest with yourself; this stays in your browser. Anything you can't tick yet is what to revisit.