The Code Book: The Science of Secrecy from Ancient Egypt to Quantum Cryptography, in detail
Simon Singh's The Code Book traces the history of cryptography from Caesar's cipher through the breaking of Enigma to the mathematics of public-key encryption and the looming possibility of quantum cryptography. Singh is one of the best science writers working, and this is probably his strongest book — the historical narrative gives the mathematics context and stakes, and the mathematics makes the history more than just a parade of dramatic stories.
The book's structure is roughly chronological but organized around key technical breakthroughs. Early chapters cover monoalphabetic and polyalphabetic substitution ciphers, the Arab polymaths who invented frequency analysis to break them, and the centuries-long cat-and-mouse game between encryption and cryptanalysis. The Vigenère cipher was considered unbreakable for three hundred years before Charles Babbage and Friedrich Kasiski independently found its weakness in the nineteenth century. Singh explains both the cipher and its breaking clearly, and the chapter works as a standalone lesson in analytical thinking.
The Enigma chapters are the book's dramatic center. Singh reconstructs the Polish mathematicians who made the first breaks before the war, the work at Bletchley Park, and the genuine tension between operational secrecy and the mathematical attack on the cipher's structural weakness. He also addresses the human cost of keeping Ultra secret — convoys allowed to be sunk to protect the source.
The final third moves into mathematics more demanding than the earlier sections: the number theory behind RSA public-key cryptography, the PGP story as a case study in the politics of cryptographic freedom, and the quantum key distribution that uses physics rather than mathematics to guarantee secrecy. Singh is careful about what these techniques actually guarantee versus what they assume. The book ends with the possibility that quantum computers will break RSA, which in 2025 is no longer hypothetical.
The Code Book is rare among popular science books in that it teaches you to actually do things — the cipher challenges distributed with the original edition, the mathematical reasoning behind why large prime factorization is hard, the logic of public-key systems. That instructional quality lifts it above narrative history.
The big ideas
- 1.
Every encryption method has been broken eventually. The history of cryptography is a continuous arms race between encryption and cryptanalysis, not a story of permanent solutions.
- 2.
Frequency analysis — counting how often each letter appears in ciphertext — defeated monoalphabetic substitution ciphers and was developed by Arab scholars in the ninth century, centuries before European cryptography.
- 3.
The Vigenère cipher resisted cryptanalysis for 300 years before Babbage and Kasiski independently identified its vulnerability: repeated key patterns produce statistical regularities detectable by frequency analysis.