Cryptography

One-Time Pad Explained: Why It's Truly Unbreakable

11 min read
By
One-Time Pad Explained: Why It's Truly Unbreakable

NovelCrypt

In 1949, Claude Shannon published a proof that changed how we think about secrecy. Some ciphers, he showed, are stronger than others in a way that mathematics can measure — and exactly one method of encryption is perfect, in the strictest sense: even an attacker with unlimited computing power learns nothing about the message from the ciphertext. That method is the one-time pad.

It sounds too good to be true, and in practice it usually is. The one-time pad is the only cipher with information-theoretic security, and it is also almost never used, because the same property that makes it unbreakable makes it wildly impractical. Understanding both halves of that sentence — the perfection and the impracticality — teaches you what "unbreakable" actually means and why modern cryptography made a different trade.

What a One-Time Pad Is

A one-time pad encrypts a message using a key that meets four strict requirements:

The key must be truly random — not generated by any deterministic algorithm, no matter how good. It must be at least as long as the message itself. It must be used exactly once, then destroyed. And it must remain perfectly secret between sender and receiver.

Encryption is then almost embarrassingly simple. Convert the message to numbers, convert the key to numbers, and combine each pair with modular addition or exclusive-or. Encrypt ATTACKATDAWN against a random key stream, and the ciphertext is a block of characters with no statistical relationship to the original. Decryption is the same operation run in reverse.

The scheme dates from 1882, was patented in working form by Gilbert Vernam in 1919 for telegraph traffic, and is sometimes called the Vernam cipher. The name matters less than the requirement list, because every item on it is load-bearing. Our guide on the Vigenère cipher and how it was broken shows what happens when the randomness and one-time requirements are dropped.

Why It Is Mathematically Unbreakable

Shannon's insight was to define security as an attacker's state of knowledge. A cipher has perfect secrecy if the ciphertext tells the attacker nothing about the plaintext — if seeing the ciphertext does not change the probability of any candidate message.

The one-time pad achieves this by construction. Suppose the ciphertext is nine characters. Any nine-character plaintext could have produced it, because for any candidate plaintext there exists exactly one key that maps it to that ciphertext. An attacker brute-forcing every possible key does not get the right answer and nine billion wrong ones — they get every possible message, each appearing exactly once. HELLO, INVEST, BORDERS: all equally consistent with the ciphertext, none distinguishable. Trying more keys produces more possibilities, not more information. The ciphertext contains zero bits of information about the plaintext. That is perfect secrecy, and Shannon proved no cipher can exceed it — only match it.

Compare this to modern ciphers: AES-256 is believed computationally unbreakable, meaning breaking it would take absurd but finite resources. The one-time pad is unbreakable in principle, with infinite resources. The two guarantees are different in kind.

Why Each Requirement Matters

Remove any one requirement and the proof collapses — which is why the requirement list is the whole security argument.

Drop true randomness and the key becomes predictable. Keystreams from pseudo-random generators look random but are determined by a seed, and the pad degenerates into a deterministic stream cipher whose security now rests on the generator's quality, not on proof. Drop the length requirement and the key must repeat to cover a longer message, which is exactly the Vigenère cipher — broken since the 1860s. Drop the one-time rule and reuse hands the attacker a gift: exclusive-oring two ciphertexts cancels the shared key and exposes the relationship between the two plaintexts. History is littered with real failures of this one: the VENONA program, in which Soviet message pads reused under production pressure were decrypted over years, exposed espionage traffic including atomic spying.

Drop secrecy and there is nothing left to discuss — the key is the only secret in the system.

The Practical Problem: Key Distribution

Here is the contradiction that keeps the one-time pad out of everyday use. To encrypt a one-gigabyte file, you must first deliver one gigabyte of key material, securely, to the recipient. If you had a perfectly secure channel to deliver that key, you could have sent the file through it. The pad does not remove the secure-channel problem; it moves it earlier in time, requiring you to solve it in advance for every future message.

There are secondary burdens that are nearly as severe. True randomness at scale is hard — our guide on cryptographically secure random number generation explains why ordinary random functions fail cryptographic requirements. Key management is unforgiving: both parties must hold identical pads, consume them in lockstep, and destroy used material, because a copy left behind is plaintext. None of this scales to a billion HTTPS connections a day.

What the Real World Uses Instead

Modern ciphers traded information-theoretic perfection for practicality, and the trade has been spectacular. AES-256 takes a 256-bit key — a speck of data you can memorize or store in a password manager — and stretches it into an unguessable keystream computationally. No proof of perfect secrecy, but an attack cost so far beyond current capability that the distinction is academic for every realistic adversary. The combination of short reusable keys, authenticated modes, and mature hardware support is why AES and ChaCha20 run the world's traffic.

Yet the pad persists where the threat model justifies everything: diplomatic hotlines such as the Moscow-Washington link after the 1963 test-ban crisis, and espionage tradecraft, where an agent whose pad is captured reveals nothing about past messages. In those settings, the cost of key logistics is worth the guarantee no other cipher provides.

The Lesson That Shaped Modern Cryptography

Even where the pad is not used, its proof defines the ceiling every cipher is measured against. Shannon showed that perfect secrecy requires key entropy at least equal to message entropy — a result that tells designers exactly what they are giving up when they choose a short key, and why. It explains the field's modern obsessions from a single principle: randomness must be real, keystreams must never repeat, and key material must be protected as fiercely as the data itself. When you read about a nonce-reuse bug in a modern cipher, you are reading about the one-time pad requirement that got violated.

Try It Yourself

You can feel the pad's properties with the NovelCrypt AES text encryptor: encrypt one short message with two different keys and observe that the outputs share nothing — a miniature demonstration of why an unknown key leaves the attacker nothing to grip. For the classical contrast, the Caesar cipher decoder shows what a cipher looks like when its key space is too small: every guess is checkable, and the message falls immediately.

The Bottom Line

The one-time pad is the only provably unbreakable cipher: with a truly random key as long as the message, used once and kept secret, ciphertext reveals literally nothing about the plaintext, even to an attacker with infinite computing power. It is also almost never used, because keys as long as the messages must be distributed, stored, and synchronized perfectly — trading one secure-channel problem for another. Modern ciphers like AES-256 accept a computational instead of mathematical guarantee in exchange for short, practical keys. The pad remains the definition of perfection in secrecy, and its four requirements are the checklist every cipher since has tried to honor with less key material.

Frequently Asked Questions

Why is the one-time pad unbreakable?

Because the key is truly random and as long as the message, every possible plaintext of the same length is equally consistent with any given ciphertext. An attacker who tries every key gets every possible message back — HELLO, GOODBY, ATTACK — with no way to tell which is real. Claude Shannon proved mathematically in 1949 that this perfect secrecy cannot be improved upon.

Why do we not use one-time pads for everything?

Key distribution. The key is as long as the message and must be delivered securely in advance, so you need a perfectly secure channel — which is what you were trying to create. You also need truly random keys, generated fresh for every message, and both parties must store and synchronize them perfectly. Modern ciphers solve the same problem pragmatically with short keys instead.

What happens if a one-time pad key is reused?

Reusing a pad turns the cipher into a breakable Vigenère-style cipher. An attacker can exclusive-or the two ciphertexts together, which cancels the key out and yields the exclusive-or of the two plaintexts — enough to recover both messages through analysis. The "one-time" in the name is the entire security argument.

Where are one-time pads used today?

Mainly in diplomatic and military channels where secrecy outweighs any cost: the Moscow-Washington hotline used one-time pads, and espionage tradecraft still relies on them because captured pads reveal nothing about past traffic. Some quantum key distribution systems use pad-like keys. For everyday encryption, AES and ChaCha20 replaced the pad because short keys are practical to distribute and manage.

Try NovelCrypt Tools

Experience military-grade encryption for your sensitive data. Create self-destructing messages, encrypt files, or explore our experimental lab tools.

Explore NovelCrypt