2.1 Perfect Secrecy and the One-Time Pad
Every cipher in Chapter 1 was broken the same way: encryption left a trace of the plaintext in the ciphertext, and the attacker measured the trace. A more elaborate scramble would only postpone the measurement. What was missing was a definition sharp enough to prove that no trace is left at all, and Claude Shannon supplied it in 1949 in Communication Theory of Secrecy Systems, together with the first proof that a particular cipher meets it. The cipher was already thirty years old: the one-time pad.
The pad itself predates the proof. In 1917 Gilbert Vernam, at AT&T, built a telegraph cipher that combined the message with a key supplied on a paper tape; the step that turns the idea into a one-time pad, a key that is truly random, as long as the message, and never reused, is credited to Joseph Mauborgne. The design is fast and obviously correct, and for three decades its security rested on intuition. Shannon proved that the intuition is right, and that no cipher with a shorter key can be.
2.1.1 The one-time pad
Every statement in this chapter quantifies over the key space, the message space, and the ciphertext space, so the definition from Section 1.2 is worth restating in full:
Definition (cipher)
A cipher (or encryption scheme)
, the encryption algorithm, and , the decryption algorithm,
such that for every key
Encryption may be randomized; decryption is always deterministic. The sets
The one-time pad fixes a length
That is the entire design. With
Encryption and decryption are the same operation and both are bitwise, so the pad costs one XOR per bit and runs at memory speed, which is as cheap as encryption gets. The cost sits in the key. A pad is as long as the message it protects, so a 1 GB file needs close to
The obvious objection: if Alice and Bob can move a 1 GB key, they could move the 1 GB message the same way. The difference is timing and reuse. A key can be agreed on years in advance, before the message exists, and a given key protects exactly one message, so the channel that later carries the message can be completely public. The cost remains: every bit of protected traffic consumes a bit of pre-distributed secret, and most systems cannot afford it.
Quiz: You are given a message and its one-time-pad ciphertext . Can you compute the key?
Yes, immediately:
2.1.2 What should “secure” mean?
Two definitions suggest themselves, and both fail. Seeing why tells us what the right definition must say.
Attempt 1: the attacker cannot recover the key. This is neither sufficient nor necessary. It is not sufficient because a cipher can simply ignore its key: define
Attempt 2: the attacker cannot recover the whole message. For
and decrypt by re-XORing the last bit. The attacker reads
Both attempts fail in the same way: they name one task the attacker must fail at, instead of a quantity she must not learn. An attacker who cannot compute FROM, or that its first two letters repeat, and each of those facts can be worth more than the computation she is denied. Chapter 1 exploited exactly such facts.
Shannon’s move was to forbid every fact at once: the ciphertext must leave the attacker’s knowledge of the message exactly where it was. Not “
2.1.3 Perfect secrecy
Fix a message and think of the ciphertext as a random variable, randomized by the key. If the cipher is any good, the distribution of that variable should not depend on which message was encrypted: the same histogram for
Definition (perfect secrecy)
Let
Three points about the definition are easy to miss.
- The probability is over the uniform key only. The message is fixed, not random; distributions on
appear when we interpret the definition, not when we state it. - The equality is required for every ciphertext, including strings that no key produces. There both sides are zero, and the condition holds trivially.
- Messages are all of one length, and the restriction is not cosmetic. If the ciphertext is as long as the plaintext, as in the natural variable-length pad, then the length of
reveals the length of : with a secret key , a one-bit message leaves a one-bit ciphertext that matches with probability , while a two-bit message can never produce a one-bit ciphertext. The fix is padding: make all messages the same length, then encrypt.
With that in hand, the definition has an equivalent form that is easier to remember. Give the message any distribution independent of the key, and let
because the factor
Perfect secrecy is an information-theoretic notion. It quantifies over all attackers with unlimited time and memory, and over all properties of the message at once, so it rules out every ciphertext-only attack rather than a list of known ones.
2.1.4 Counting keys
The definition compares probabilities, but every probability here is a fraction of the key space, and fractions are easier to count than to argue about.
Lemma (probability is a key count)
For fixed
The key is uniform, so each of the
Theorem (counting characterization)
A cipher over
(The number may depend on the ciphertext, but not on the message.)
Proof. For the forward direction, fix
This is the form in which perfect secrecy is checked in practice: for each ciphertext, count how many keys lead to it from each message. The count may vary with
2.1.5 The one-time pad is perfectly secret
Theorem (one-time pad)
The one-time pad over
Proof. Fix
Quiz: How many one-time pad keys map a given message to a given ciphertext ?
Exactly one. XORing both sides of
The proof says more than the definition needs. Since the count is
The ciphertext is uniform on
For
00 | 01 | 10 | 11 | |
01 | 00 | 11 | 10 | |
10 | 11 | 00 | 01 | |
11 | 10 | 01 | 00 |
Read it by column: each column contains each ciphertext exactly once, so the count is
2.1.6 The price of perfect secrecy
Perfect secrecy is strong enough to determine the size of the key, and the reason is counting. Take a ciphertext
Theorem (Shannon’s theorem)
If a cipher over
Proof. Suppose instead that
be the set of messages that some key decrypts
a contradiction. Hence
Note what the proof does not assume. The attacker never recovers
For
The theorem is a statement about information, not about effort: no cipher design avoids it. The only way around it is to change the definition, so that only feasible adversaries count and any advantage they gain must be negligible. That relaxation is where computation enters cryptography, and it is where the rest of Chapter 2 goes.
One limit of the model matters before moving on: perfect secrecy covers a single message under a single use of the key, and says nothing about an attacker who can alter the ciphertext in transit. Both are taken up later.