Vernam Cipher
The XOR operation that underpins every modern stream cipher — patented in 1917
Why This Matters
Gilbert Vernam’s 1917 XOR-based teleprinter cipher is the direct ancestor of every modern stream cipher. ChaCha20, AES-CTR, and AES-GCM all use the same XOR operation he patented over a century ago.
Gilbert Vernam was an AT&T Bell Labs engineer who in 1917 patented an automatic cipher for teleprinter communications. Messages on punched paper tape were XOR'd with a key tape character by character. When Joseph Mauborgne suggested using a completely random, non-repeating key tape, they had invented the One-Time Pad — though Shannon would not prove its perfection for another 32 years.
The Vernam cipher is the direct ancestor of every modern stream cipher. ChaCha20, AES-CTR, and AES-GCM all use the XOR operation Vernam patented. The difference is that modern ciphers generate their keystream from a short key and a nonce, rather than requiring a physical tape as long as the message.
The Vernam cipher operates at the bit level using the XOR (exclusive or) operation. Each bit of the plaintext is combined with the corresponding bit of the key.
Ciphertext = Plaintext XOR Key (bitwise) H = 01001000 K = 10110100 (key byte) C = 11111100 (ciphertext) Decryption is identical: C XOR K = P (XOR is its own inverse) When key tape is: Random + same length + used once → One-Time Pad (unbreakable) Repeating or non-random → Vigenère-equivalent (breakable)
The elegance of XOR is that applying the same key a second time returns the plaintext: C XOR K = P. There is no separate decryption algorithm — the demo's Decrypt button simply reads the hex bytes back in and XORs them with the key again.
About this demo: Plaintext is normalized to the letters A–Z, XORed byte-by-byte with the key, and the ciphertext is displayed as two hexadecimal digits per byte — so Decrypt expects hex input, not letters. Leave the key blank and the demo generates a random pad using the browser's secure random source, appending it to the output as [Key: …]. A key shorter than the message is rejected rather than repeated, and a raw byte key can be supplied as hex:<bytes>.
When key tapes were reused (common under operational pressure), XOR-ing two ciphertexts cancels the key: C1 ⊕ C2 = P1 ⊕ P2. This reduces to a running-key cipher attack. If the key was non-random (e.g. a text passage), statistical properties of the key language leak through.
VENONA: Soviet operators reused one-time pad key pages under WWII supply pressure. The same depth attack that breaks a reused Vernam tape broke thousands of Soviet intelligence messages — exposing the Rosenbergs and Klaus Fuchs.
| Concept from Vernam | Modern Evolution |
|---|---|
| XOR as cipher operation | All modern stream ciphers: C = P ⊕ keystream |
| Key tape = keystream | ChaCha20 generates 512-bit blocks of keystream per counter value |
| Reused key = catastrophic failure | Nonce uniqueness: AES-GCM fails catastrophically on nonce reuse |
| Automatic teleprinter encryption | Hardware crypto acceleration: AES-NI CPU instructions |
A short Vernam message, exactly as the demo above produces it. Use what you just learned.
Key: KEYS · Hint: each pair of hex digits is one XORed byte. Paste ciphertext and key into the demo above, or work the XOR by hand.
Depth attack works if any key material reused. If OTP rules followed: mathematically proven unbreakable (100%).
| Exhibit | 34 of 40 |
| Era | 1917 |
| Security | Weak if key reused |
| Inventor | Gilbert Vernam |
| Year | 1917 |
| Broken By | Key reuse / depth attack |