A History of Cryptography
- A History of Cryptography
- Why the history is worth your time
- Antiquity: substitution and transposition
- The Arab breakthrough: frequency analysis
- The polyalphabetic era: le chiffre indéchiffrable
- Mechanization: rotor machines and Enigma
- The mathematical turn: Shannon and perfect secrecy
- The public standards era: DES and AES
- The public-key revolution
- Where the story is going
- Key takeaways
- References
Why the history is worth your time
Every cipher on this page was, in its day, believed to be secure — and every one of them fell. That is not a coincidence; it is the single most important lesson in the field. The cryptography reference tells you which primitives to use today (AES-GCM, X25519, Argon2id); this page tells you why the profession is so insistent that you never roll your own and always prefer standard, publicly-vetted algorithms. The history is a two-thousand-year record of confident designers being outsmarted by patient analysts, and the modern discipline — Kerckhoffs’s principle, open standards, public review — is the scar tissue left behind.
The story runs through four great shifts:
- Substitution and transposition — hiding a message by scrambling its letters (antiquity → ~1900).
- Cryptanalysis as a science — frequency analysis turns codebreaking from art into method (9th century onward).
- Mechanization — rotor machines industrialize encryption, and mathematics industrializes breaking them (WWI–WWII).
- The mathematical era — Shannon proves what “secure” even means, and public-key cryptography solves the key-distribution problem that had shackled everyone before (1949 → today).
⚠️ “Unbreakable” is a marketing claim, not a security property. The Vigenère cipher was sold as le chiffre indéchiffrable for three centuries before Babbage and Kasiski dismantled it; the Enigma was trusted absolutely by an entire military while it was being read daily. When you see “unbreakable” in a product pitch, read it as “not yet analyzed by anyone who published.”
Antiquity: substitution and transposition
The two mechanical ideas underneath almost all pre-modern ciphers appear very early:
| Technique | Idea | Ancient example |
|---|---|---|
| Transposition | Keep the letters, change their order | The Spartan scytale (c. 7th–5th c. BCE): a strip of parchment wound around a rod of a specific diameter; the message reads correctly only when re-wound on a rod of the same size |
| Substitution | Keep the order, change the letters | The Caesar cipher (1st c. BCE): shift each letter a fixed number of places down the alphabet |
The Caesar cipher — reportedly used by Julius Caesar with a shift of three — is the canonical monoalphabetic substitution cipher: one fixed alphabet maps plaintext letters to ciphertext letters. It is trivial today, but it establishes the vocabulary (plaintext, ciphertext, key) the whole field still uses.
Worked example: the Caesar cipher
def caesar(text: str, shift: int) -> str:
out = []
for ch in text:
if ch.isalpha():
base = ord('A') if ch.isupper() else ord('a')
out.append(chr((ord(ch) - base + shift) % 26 + base))
else:
out.append(ch) # punctuation/spaces pass through
return ''.join(out)
print(caesar("Veni, vidi, vici", 3)) # -> "Yhql, ylgl, ylfl"
print(caesar("Yhql, ylgl, ylfl", -3)) # -> "Veni, vidi, vici"
The same shift-by-13 (ROT13) is a one-liner with tr — still used today not for secrecy but to lightly obscure spoilers and hints:
echo "The answer is behind the door" | tr 'A-Za-z' 'N-ZA-Mn-za-m'
# -> Gur nafjre vf oruvaq gur qbbe
# ROT13 is its own inverse: run it again to decode.
A Caesar cipher has only 25 useful keys, so you break it by trying them all — a brute-force search, the same idea (at vastly larger scale) behind modern hash cracking. Even a full monoalphabetic substitution, with its 26! ≈ 4×10²⁶ possible key mappings, feels unbreakable by brute force. It isn’t — and the reason why is the first great idea in cryptanalysis.
The Arab breakthrough: frequency analysis
Around 850 CE in Baghdad, the polymath al-Kindī wrote Risālah fī Istikhrāj al-Muʿammā (“A Manuscript on Deciphering Cryptographic Messages”), the earliest known text on cryptanalysis — and the earliest known use of statistical inference of any kind. His insight: in any language, letters occur with characteristic, stable frequencies. A monoalphabetic cipher hides which letter is which, but not how often each appears. Count the ciphertext symbols, line up the most common ones against the language’s known frequency profile (in English: E, T, A, O, I, N, …), and the key falls out — no matter how many billions of keys the cipher nominally has.
This is the moment codebreaking became a science. It also set the template for the entire adversarial relationship at the heart of security: a design that looks strong by one measure (key count) collapses under an attack that measures something else entirely (statistics). (Al-Kindī’s manuscript itself was lost for a millennium, rediscovered in the Sülemaniye Ottoman archive in Istanbul and finally published in 1987.)
Worked example: breaking substitution with a letter count
from collections import Counter
ciphertext = """Wkh txlfn eurzq ira mxpsv ryhu wkh odcb grj.
Wkh txlfn eurzq ira mxpsv ryhu wkh odcb grj djdlq."""
counts = Counter(c for c in ciphertext.lower() if c.isalpha())
total = sum(counts.values())
for ch, n in counts.most_common(6):
print(f"{ch}: {n:2d} ({100*n/total:.1f}%)")
# The ciphertext letter that dominates almost certainly maps to plaintext 'e'
# or 't'; from there you bootstrap the rest against English frequencies.
# (This text is a Caesar shift of 3 — 'wkh' is 'the'.)
The Wkh → the giveaway is why short, repeated, high-frequency words (the, and, of) are the analyst’s first foothold. Frequency analysis is why every classical single-alphabet cipher is, for practical purposes, already broken.
The polyalphabetic era: le chiffre indéchiffrable
The defense against frequency analysis is to stop using one alphabet. The Vigenère cipher (popularized in the 16th century and long misattributed to Blaise de Vigenère) uses a keyword to switch among 26 different Caesar shifts as you move through the message. The same plaintext letter now encrypts to different ciphertext letters depending on its position, which flattens the frequency distribution and defeats al-Kindī’s attack head-on.
It worked so well that for roughly three centuries it was called le chiffre indéchiffrable — “the indecipherable cipher.”
Worked example: the Vigenère cipher
def vigenere(text: str, key: str, decrypt: bool = False) -> str:
out, ki = [], 0
for ch in text:
if ch.isalpha():
base = ord('A') if ch.isupper() else ord('a')
k = ord(key[ki % len(key)].lower()) - ord('a')
if decrypt:
k = -k
out.append(chr((ord(ch) - base + k) % 26 + base))
ki += 1 # key advances only on letters
else:
out.append(ch)
return ''.join(out)
ct = vigenere("ATTACKATDAWN", "LEMON")
print(ct) # -> LXFOPVEFRNHR
print(vigenere(ct, "LEMON", decrypt=True)) # -> ATTACKATDAWN
How the unbreakable cipher broke
The keyword is also the weakness: because it repeats, so does the cipher. Two breakthroughs in the mid-19th century exploited that repetition:
- Charles Babbage broke Vigenère around 1854 (prompted by a challenge in a journal) but never published — his work surfaced only a century later in his notes.
- Friedrich Kasiski, a retired Prussian officer, published the first general attack in 1863. The Kasiski examination finds repeated substrings in the ciphertext, uses the distances between them to deduce the key length, and thereby splits the message into several independent Caesar ciphers — each of which yields to frequency analysis. The “indecipherable” cipher was reduced to a problem al-Kindī had already solved.
⚠️ Reuse is the enemy. Vigenère fell because the keystream repeated. This is the same failure mode as reusing a one-time pad, reusing an AES-GCM nonce, or reusing a Diffie–Hellman key across sessions. “Never reuse keystream/nonces/keys” is one continuous lesson stretching from 1863 to your last code review.
Mechanization: rotor machines and Enigma
Manual polyalphabetic ciphers are slow and error-prone. In the early 20th century, engineers automated them with rotor machines: wired wheels that advance after each keystroke, producing an enormous, ever-changing sequence of substitution alphabets. The German Enigma — with its rotors, reflector, and (crucially) a rewireable plugboard — offered on the order of 10²³ possible settings and was trusted as unbreakable by the German military through World War II.
It was read anyway. The story is a landmark in the history of computing as much as cryptography:
- Poland, 1932–1939. Mathematician Marian Rejewski, with Jerzy Różycki and Henryk Zygalski at the Polish Cipher Bureau, achieved the first mathematical break of Enigma by treating the machine as a problem in permutation group theory. In 1938 they built the bomba kryptologiczna, an electromechanical machine to search rotor settings. Weeks before the 1939 invasion, Poland handed its Enigma replicas and methods to Britain and France — arguably shortening the war by exposing the head start.
- Bletchley Park, 1939–1945. Alan Turing and Gordon Welchman generalized the Polish approach into the British Bombe, which exploited cribs (guessed plaintext, like predictable weather reports) and Enigma’s own quirk that no letter ever encrypted to itself. The industrialized codebreaking effort (“Ultra” intelligence) fed the Allied war machine and helped birth modern computing.
The lesson repeats with a new twist: Enigma’s operators believed the sheer size of the keyspace was protection. But operational mistakes (repeated message keys, stereotyped openings, a letter never mapping to itself) gave analysts the statistical footholds a machine could then exploit at scale. Key size is necessary, never sufficient.
The mathematical turn: Shannon and perfect secrecy
Two developments turned cryptography from craft into mathematics.
- The one-time pad. In 1917, Gilbert Vernam at AT&T patented a cipher that XORs the plaintext with a key stream (patent granted 1919). If that key is truly random, as long as the message, used only once, and kept secret, the result is genuinely unbreakable.
- A proof of “unbreakable.” In 1949, Claude Shannon’s Communication Theory of Secrecy Systems gave the field its theoretical foundation and proved the one-time pad has perfect secrecy: the ciphertext reveals literally zero information about the plaintext, because every plaintext of that length is equally consistent with it. For the first time, “secure” had a precise, provable definition rather than a track record of not-yet-being-broken.
So why don’t we use one-time pads everywhere? Because their strength is their impracticality: you need as much perfectly-random, secret key material as you have data to send, delivered in advance over a secure channel — which is the very key-distribution problem you were trying to solve. Break any of the four conditions — reuse the pad, use a non-random “pad,” reveal it — and perfect secrecy evaporates instantly. (The reused-pad mistake is exactly how the U.S. VENONA project read Soviet traffic.) Shannon’s real gift was the framework: from here on, ciphers would be judged against defined attacker models, not reputation.
The public standards era: DES and AES
Shannon’s mathematics met the computer, and by the 1970s commerce and government needed a standard cipher anyone could implement interoperably.
- DES (Data Encryption Standard). The U.S. National Bureau of Standards issued a public call; IBM’s Lucifer design, adjusted with NSA involvement, became FIPS 46 in 1977. DES was hugely influential but carried two clouds: a controversially short 56-bit key (brute-forceable, and eventually broken in public by the EFF’s “Deep Crack” machine in 1998) and mysterious NSA-tweaked S-boxes. Years later, the public rediscovery of differential cryptanalysis revealed that those S-boxes had been hardened against exactly that attack — IBM and NSA had known about it and kept it classified. A cautionary tale in both directions: hidden design rationale erodes trust, even when the design is sound.
- AES (Advanced Encryption Standard). NIST did the opposite the next time. From 1997–2000 it ran an open, international competition, publishing every candidate for the world’s cryptanalysts to attack. The Belgian Rijndael cipher (Joan Daemen and Vincent Rijmen) won on the strength of public analysis and was standardized as FIPS 197 in 2001. AES is the symmetric workhorse you still use today, and its selection process is the model for how post-quantum standards were later chosen.
The arc from DES to AES is the professionalization of the field: from a closed process with unexplained parameters to fully public design, review, and standardization. It is Kerckhoffs’s principle — the security must rest in the key, not the secrecy of the algorithm — vindicated as policy.
The shrinking gap: introduction vs. brute force
The 20th century’s defining pressure on symmetric ciphers was Moore’s law: a key size that was comfortably beyond brute force at introduction can become searchable on ordinary hardware a couple of decades later. The timeline below shows, for four 20th-century ciphers, the span from when each entered service to when it could be exhaustively brute-forced on commodity hardware — the machines a hobbyist or a volunteer computing project could actually field.
The striking part is that the gap is not a smooth downward trend. Export-grade crypto was deliberately crippled and fell in weeks; DES had a long, useful life before Moore’s law caught it; and AES was designed with enough key-length margin that brute force never becomes the threat at all — its bar runs off the right edge and does not stop.
gantt title From introduction to commodity brute force (20th–21st century) dateFormat YYYY axisFormat %Y todayMarker off
section Enigma
In service → wartime break (cryptanalysis*) :done, enig, 1930, 1945
section RC4-40 export SSL
Introduced → broken in weeks :crit, rc4, 1995, 1996
section DES 56-bit
FIPS 46 → distributed.net crack (~22 yrs) :crit, des, 1977, 1999
section AES 128-bit
FIPS 197 → no feasible brute force → :active, aes, 2001, 2040
| Cipher | Key strength | Introduced | Brute-forced on commodity hardware | Gap |
|---|---|---|---|---|
| Enigma | mechanical (huge, but reducible) | ~1930 (military service) | Never by pure brute force — read 1939–45 by cryptanalysis exploiting operator error and the no-letter-maps-to-itself flaw | n/a* |
| RC4-40 (export SSL) | 40-bit | 1995 (SSL 2.0) | 1995 — Doligez brute-forced the Netscape 40-bit challenge in ~8 days on ~120 workstations | weeks |
| DES | 56-bit | 1977 (FIPS 46) | 1999 — distributed.net + EFF “Deep Crack” recovered a key in 22h15m (Deep Crack itself was purpose-built ASIC; distributed.net was volunteer commodity PCs) | ~22 years |
| AES | 128-bit | 2001 (FIPS 197) | Not feasible — 2¹²⁸ ≈ 3.4×10³⁸ keys; no foreseeable commodity (or non-commodity) hardware brute-forces it | unbounded |
* Enigma is included for scale, but it is the exception that proves the rule: it was never beaten by brute force. Its ~10²³-key space was too large for 1940s brute force, so the Allies won by cryptanalysis — attacking the machine’s structure and its operators’ habits, exactly as al-Kindī attacked substitution ciphers with statistics. Today a laptop trivially searches Enigma’s rotor settings; it is the plugboard that keeps naive brute force expensive, which is why modern Enigma attacks are still cryptanalytic rather than exhaustive.
⚠️ The lesson for choosing key sizes. “Secure against brute force today” is a statement with an expiry date unless you build in margin. 56-bit DES looked fine in 1977 and was a liability by the late 1990s; this is precisely why AES starts at 128 bits and offers 256, and why guidance like NIST SP 800-131A formally retires algorithms and key lengths on a schedule. When you pick a cipher, pick one whose brute-force bar runs off the edge of your data’s lifetime.
The public-key revolution
Every cipher so far, from Caesar to AES, is symmetric: sender and receiver share the same secret key. That leaves the ancient, unsolved problem — how do two parties who have never met agree on a key over a channel someone is watching? For all of history, the answer was “meet in advance, or trust a courier.”
In the 1970s that problem was solved, twice, secretly and then publicly:
- 1976 — Diffie–Hellman. Whitfield Diffie and Martin Hellman’s New Directions in Cryptography introduced public-key cryptography and a way for two parties to derive a shared secret over a public wire (key exchange) — without ever transmitting it.
- 1977 — RSA. Ron Rivest, Adi Shamir, and Leonard Adleman built the first practical public-key encryption and digital-signature scheme, resting on the difficulty of factoring large numbers.
The secret prehistory
The twist: GCHQ, Britain’s signals-intelligence agency, got there first — and told no one. James Ellis described “non-secret encryption” in 1970; Clifford Cocks worked out the RSA algorithm in essentially its final form in 1973; and Malcolm Williamson derived Diffie–Hellman key exchange shortly after. All three were classified. The work stayed secret until GCHQ declassified it in 1997 — Ellis died a month before the announcement, never publicly credited in his lifetime.
There are two lessons here, and both matter for how you think about security:
- Priority of publication is how the public field assigns credit — and, more importantly, public disclosure is what let the rest of the world use, review, and trust these ideas. Cocks’s algorithm sat useless in a vault for two decades; Rivest, Shamir, and Adleman’s identical idea, published, became the foundation of internet commerce.
- Kept-secret cryptography benefits only its keeper. The open ecosystem — TLS, PKI, signed software updates, encrypted messaging — exists because these primitives were published and scrutinized in the open.
Where the story is going
The pattern hasn’t stopped. The public-key schemes that secure the modern internet rest on problems (factoring, discrete logarithms) that a large quantum computer would break — so “harvest now, decrypt later” makes traffic captured today a future liability. NIST ran another open, AES-style competition and standardized the first post-quantum replacements in 2024. That transition — and the specifics of how to deploy it — is covered at the end of the cryptography reference. If the history teaches anything, it is that today’s “unbreakable” is tomorrow’s worked example.
Key takeaways
- Every historical cipher fell, usually because designers overestimated one property (key count, machine complexity) while an analyst attacked another (letter statistics, keystream repetition, operator error). Confidence is not a security property.
- Two mechanical ideas — substitution and transposition — underlie all pre-modern ciphers, and both yield to frequency analysis, the 9th-century breakthrough of al-Kindī that made codebreaking a science.
- Polyalphabetic ciphers (Vigenère) defeated frequency analysis by hiding letter statistics — until Babbage (1854) and Kasiski (1863) exploited the repeating key. Reuse of keystream/nonces/keys is a failure mode that runs unbroken from 1863 to today.
- Enigma shows that a huge keyspace is defeated by operational mistakes plus mathematics: Polish (Rejewski) and British (Turing, Welchman) codebreakers read it throughout WWII and helped invent computing in the process.
- Shannon (1949) gave “secure” a provable meaning (perfect secrecy), realized by the one-time pad — theoretically unbreakable but impractical because it just relocates the key-distribution problem.
- The move from DES (closed process, secret S-box rationale, 56-bit key) to AES (open competition, public review, FIPS 197 in 2001) is the field professionalizing around Kerckhoffs’s principle: trust the key, not the secrecy of the algorithm.
- Public-key cryptography (Diffie–Hellman 1976, RSA 1977) finally solved key distribution — and the fact that GCHQ discovered it secretly years earlier but couldn’t use it shows why published, reviewed cryptography is what actually secures the world.
References
- S. Singh, The Code Book (1999) — the standard popular history of cryptography.
- D. Kahn, The Codebreakers (1967, rev. 1996) — the definitive comprehensive history.
- al-Kindī and the birth of cryptanalysis — https://en.wikipedia.org/wiki/Al-Kindi
- Vigenère cipher, Babbage, and the Kasiski examination — https://en.wikipedia.org/wiki/Vigen%C3%A8re_cipher
- The Enigma machine — https://en.wikipedia.org/wiki/Enigma_machine
- The Bombe (Polish bomba and the Bletchley Park Bombe) — https://en.wikipedia.org/wiki/Bombe
- C. Shannon, Communication Theory of Secrecy Systems (1949) — https://archive.org/details/bstj28-4-656
- One-time pad and perfect secrecy — https://en.wikipedia.org/wiki/One-time_pad
- W. Diffie and M. Hellman, New Directions in Cryptography (1976) — https://ee.stanford.edu/~hellman/publications/24.pdf
- NSA historical profile of Ellis, Cocks, and Williamson (GCHQ public-key prehistory) — https://www.nsa.gov/History/Cryptologic-History/Historical-Figures/Historical-Figures-View/Article/3006218/clifford-cocks-james-ellis-and-malcolm-williamson/
- NIST FIPS 197 — Advanced Encryption Standard (AES). https://csrc.nist.gov/pubs/fips/197/final
Related course pages: Cryptography · Security Principles and Approaches · Hash Cracking with Hashcat and John · Access Control and Authorization
🛠️ Maintenance note: the historical facts here are stable, but the forward-looking pointer to the post-quantum transition is a moving target — keep it as a link to the cryptography page rather than duplicating algorithm names/dates here, so there is only one place to update. Re-verify the external history links (several are Wikipedia) resolve at the start of each term.