Skip to content
mentua.org

"The Code Book" by Simon Singh: Summary and Review

Line drawing of a cipher disk with two rings of letter marks, the inner ring turned by a few places and one filled segment showing the shiftLine drawing of a cipher disk with two rings of letter marks, the inner ring turned by a few places and one filled segment showing the shift

10 min read≈ 2,300 words5 questions · up to 5 points

What this is about

The Code Book tells the history of secret writing, from a queen who was executed because of her cipher to the codes that protect online payments. You learn the eight ideas that carry the book, how it compares with David Kahn's much longer history, and which of its chapters experts have criticised.

The book in three sentences· skip ahead

Simon Singh tells the history of cryptography as an arms race in which every new cipher is used until codebreakers find its weakness, and then a stronger cipher replaces it. He follows this race from frequency analysis in the ninth century through the Vigenère cipher and the Enigma machine to public-key cryptography. He ends with the political fight over strong encryption and with the hope that quantum physics will one day give the codemakers a final victory.

The Code Book

Author
Simon Singh
Published
1999
Publisher
Fourth Estate (UK paperback, 2000)
Length
416 pages
Audiobook
10h 27m, read by Patty Nieman
Best for
Curious readers without a mathematics background who want the history of codes and the main ideas behind modern encryption.

On 8 February 1587, Mary Queen of Scots was beheaded at Fotheringhay Castle, and the evidence that convicted her came from her own enciphered letters. Simon Singh opens The Code Book with this story because it shows his whole subject in one case: a secret message, a codebreaker who reads it, and a life that depends on the result. Singh is a British science writer with a doctorate in particle physics from Cambridge, and his first book, Fermat’s Last Theorem, came out in 1997. The Code Book appeared in 1999, when email and online shopping were spreading fast and governments were arguing about who should be allowed to use strong encryption.

What kind of book this is

The book has eight chapters that run roughly in time order, from ancient Greece to the late 1990s. Each chapter tells one big step in making or breaking codes through the people involved, and explains the method well enough for you to try it. The British edition is subtitled The Secret History of Codes and Codebreaking. In the United States it appeared first as The Evolution of Secrecy from Mary, Queen of Scots, to Quantum Cryptography and later as The Science of Secrecy from Ancient Egypt to Quantum Cryptography.

Singh explains two basic terms in his introduction. In a code, a whole word or phrase is replaced by another word or symbol. In a cipher, each letter is replaced. Most of the book is about ciphers, and Singh admits that it should really have been called The Code and Cipher Book. This review follows the eight ideas that carry the book, roughly in the order Singh tells them.

Codemakers and codebreakers are locked in an arms race

The idea that holds the book together is an “evolutionary struggle” between the people who make codes and the people who break them. Singh compares a code to a strain of bacteria: it thrives until doctors find an antibiotic that exposes its weakness, and then it either dies out or evolves into a stronger form. In the same way, a cipher is used until codebreakers find its weakness, and then a better cipher replaces it.

This frame gives the book a clear direction, because each step in the story answers the one before: a cipher is broken, and the codemakers look for a stronger one. Singh also argues that the race has driven science forward, because both sides drew on mathematics, linguistics and later physics, and their work helped to create the modern computer. The frame has a cost, which the last part of this review returns to: it makes the history look tidier than it was.

Frequency analysis broke the simple substitution cipher

Singh’s first great turning point is frequency analysis, the method of breaking a cipher by counting how often each symbol appears. In a substitution cipher, each letter of the alphabet is always replaced by the same other letter or symbol. In English, E is the most common letter, so the most common symbol in a long enciphered English text probably stands for E. The earliest known description of this method comes from al-Kindi, an Arab scholar of the ninth century.

Singh explains the method step by step and then breaks a short ciphertext in front of you, which is one of the best passages in the book. He shows that counting is only the start, because short texts break the averages and the codebreaker also needs guesswork about common words and letter pairs. Then he returns to Mary. Her letters to the conspirator Anthony Babington used a mix of codewords and cipher, and Thomas Phelippes, who worked for Queen Elizabeth’s spymaster Francis Walsingham, broke it with frequency analysis. Mary and Babington trusted their cipher, so they wrote openly about the plan to kill Elizabeth.

The cipher of Mary Queen of Scots clearly demonstrates that a weak encryption can be worse than no encryption at all.

Simon Singh, The Code Book, chapter 1

The same chapter introduces Kerckhoffs’ principle, set out by the Dutch linguist Auguste Kerckhoffs in 1883. It says that a cipher system must stay safe even when the enemy knows the method, so all the secrecy must lie in the key. This rule still guides cryptography today.

The Vigenère cipher looked unbreakable until Babbage and Kasiski

Chapter 2 is about the answer to frequency analysis: the Vigenère cipher, which uses several cipher alphabets in turn, so that the same plain letter comes out differently at different places in the message. A keyword decides which alphabet is used for each letter. Because one letter no longer always becomes the same symbol, simple counting fails. It became known as le chiffre indéchiffrable, French for “the undecipherable cipher”, which is also the chapter title.

Singh’s hero here is Charles Babbage, the English inventor of early calculating machines, who broke the cipher around 1854. He found that a repeated keyword leaves repeated patterns in the ciphertext, and these patterns reveal how long the keyword is. Once you know the length, the message splits into several simple substitution ciphers, and frequency analysis works again. Babbage never published his method, and Friedrich Kasiski published the same attack independently nine years later. Singh suggests that British secrecy during the Crimean War may explain Babbage’s silence. The chapter also tells the story of the Beale ciphers, enciphered texts said to describe where a treasure of gold was buried in Virginia in the nineteenth century. Nobody has found it.

Machines and war made codebreaking decide history

In the twentieth century, radio made it easy to send messages and just as easy to intercept them. Singh’s story for the First World War is the Zimmermann telegram of January 1917, a German offer of an alliance with Mexico against the United States. British codebreakers read it and passed it on, which helped to bring America into the war.

The same chapter introduces two answers to the codebreakers. The first is the one-time pad, a cipher with a random key as long as the message that is never used again. Singh explains why it cannot be broken and why, in his account, it was rarely used in practice. The second is the Enigma machine, which Arthur Scherbius invented in Germany after the First World War. Its turning wheels changed the cipher alphabet after every letter, and Singh calls it the most secure system of cryptography of its time.

Enigma was broken, first by the Poles and then at Bletchley Park

Chapter 4, which the physicist Artur Ekert called the best part of the book in his review, tells how Enigma fell. The first break came in Poland. In 1932 the mathematician Marian Rejewski worked out the wiring of the machine’s wheels, and the Polish team went on to find the daily settings for years. In July 1939, about five weeks before the war began, the Poles handed their work to the British and the French.

At Bletchley Park, the British codebreaking centre, Alan Turing and his colleagues designed the bombes, electromechanical machines that tested possible Enigma settings against a word or phrase the codebreakers expected the message to contain. For Singh, Bletchley Park is also the clearest case of his point that cryptography is a secret science: the codebreakers’ success had to stay secret for decades, so most of them were never recognised in their lifetimes. Turing’s later ideas about thinking machines are the subject of What Is the Turing Test?

Reading lost scripts is a close relative of codebreaking

Chapter 5 is what Singh calls “a minor detour”. It tells the story of the Navajo code talkers, Native American soldiers who used their own language as a spoken code for the US Marines in the Pacific during the Second World War. It also tells the story of how ancient scripts were read again: Jean-François Champollion’s reading of Egyptian hieroglyphs, and Michael Ventris’s proof in 1952 that the Bronze Age script called Linear B was an early form of Greek. These scripts were never meant to be secret, but reading them needs the same mix of pattern-finding and guesswork as breaking a cipher. It is enjoyable but adds little to the main argument.

Public-key cryptography solved the key distribution problem

Chapter 6, called “Alice and Bob Go Public”, tells how cryptographers solved the key distribution problem: before two people could write in secret, they had to share a secret key, which meant meeting or trusting a courier. In 1976, Whitfield Diffie and Martin Hellman, building on ideas by Ralph Merkle, showed in public how two people could agree on a key over an open line.

In 1977, Ron Rivest, Adi Shamir and Leonard Adleman invented RSA. It gives each person a public key, which anyone can use to lock a message, and a private key, which only the owner has and which opens it. Singh explains the main idea of both methods without going deep into the mathematics. If you want to follow one with small numbers by hand, see What Is Public-Key Cryptography?

The chapter’s surprise is that the idea had been found earlier in secret. Singh talked to experts at GCHQ, the British signals intelligence agency, which in 1997 revealed that James Ellis, Clifford Cocks and Malcolm Williamson had found the same methods in the early 1970s. This history is one reason why Singh calls cryptography a secret science.

Strong encryption for everyone is a political question

Chapter 7 follows Phil Zimmermann, who in 1991 released Pretty Good Privacy (PGP), a free program that put strong public-key encryption on ordinary computers. The US government investigated him for exporting encryption without a licence and dropped the case in 1996. Singh uses the story to set out a debate that is still open. On one side, civil liberties groups and businesses want strong encryption for privacy and safe trade. On the other, police and intelligence services fear losing the ability to tap the communications of criminals and terrorists. Singh presents both sides fairly and suggests that the outcome depends on whom the public fears more: criminals or the government.

Quantum physics may end the race

The last chapter looks forward. A large quantum computer, a machine that uses the rules of quantum physics to calculate, could break the public-key ciphers that protect the internet. Against this threat, Singh describes quantum cryptography, which uses single particles of light to share a key, so that any eavesdropper disturbs the particles and is detected. The first scheme of this kind was published by Charles Bennett and Gilles Brassard in 1984. Singh suggests that quantum cryptography could give the codemakers a final victory in the arms race.

How it differs from other books on codes

The Code Book is best compared with three other books.

  • David Kahn’s The Codebreakers (1967) is the standard history of the subject and much longer and more detailed. In his review, Whitfield Diffie noted that Singh covers fewer topics, adds newer material and his own interviews, rather than retelling Kahn. Kahn’s book is the reference, and Singh’s is the easier introduction.
  • Andrew Hodges’s Alan Turing: The Enigma (1983) tells the Bletchley Park story in much more depth, through Turing’s life. Singh gives Bletchley one chapter but places it in a longer history.
  • Steven Levy’s Crypto (2001) covers the same ground as Singh’s chapters 6 and 7 at greater length, telling how public-key cryptography escaped from government control.

What Singh adds is the worked examples. You break a cipher yourself instead of only reading about it, and the book ends with the Cipher Challenge, ten enciphered messages of rising difficulty with a prize of £10,000. A team of five Swedish researchers solved all ten in October 2000.

Where it falls short

The book has three weaknesses. The first is accuracy in the details. Whitfield Diffie wrote that Singh had muddled parts of what he and others told him in interviews, for example by placing Diffie’s 1976 talk at IBM in 1974, and that readers would be misled in places. The mathematician Jim Reeds, reviewing the book for the American Mathematical Society, also found many small errors of fact. Diffie also disputed Singh’s claim that one-time pads were hardly ever used, since every major power used them widely. Most of these errors do not change the big picture, but they mean you should not use the book as a reference.

The second weakness is the last chapter. Ekert, himself a pioneer of quantum cryptography, wrote that this part was neither well researched nor well explained, and Diffie thought Singh overestimated both quantum computing and quantum cryptography. Since 1999 the field has moved in a different direction: in 2024 the US standards agency NIST published new public-key methods designed to resist quantum computers, which run on ordinary hardware.

The third weakness is the frame itself. The arms race makes a clear story, but it turns the history into a neat line of breakthroughs. Diffie noted that much that does not fit this line is missing or very short, such as the American SIGABA machine of the Second World War and the cipher systems used after it. Singh admits in his introduction that his account is not definitive, and that much of the real history is still classified.

Which edition and format to choose

Read it in print or as an ebook. The book is full of tables, cipher alphabets and worked examples, and you will want to follow them with a pencil or flip back to them. An audiobook read by Patty Nieman exists, but Audible lists it as abridged, and it loses exactly the parts that make the book special.

Singh also wrote a shorter version for teenagers, and his website still has the original ciphertexts of the Cipher Challenge. Read the last two chapters as history of the late 1990s, not as a guide to encryption today.

Quiz

5 questions · up to 5 points

Open a question and pick one answer. Only your first answer counts: +1 if it is right, −1 if it is wrong.

  1. How does Singh describe the history of codes in his introduction?
    Show answer

    As an evolutionary struggle in which each code survives only until codebreakers find its weakness. Singh compares codes to bacteria that must keep evolving to survive new antibiotics. A broken code either disappears or is replaced by a stronger one.

  2. What lesson does Singh draw from the case of Mary Queen of Scots?
    Show answer

    A weak cipher can be worse than none, because it makes people write openly about secrets. Mary and Babington trusted their cipher, so they wrote plainly about the plot. Thomas Phelippes broke it with frequency analysis, and the letters convicted her.

  3. According to the book, who first broke the Enigma cipher?
    Show answer

    Polish codebreakers led by Marian Rejewski, years before Bletchley Park took over the work. The book gives the Poles the first break. Bletchley Park built on their work when the Germans made Enigma stronger.

  4. What problem did public-key cryptography solve, according to Singh?
    Show answer

    Two people had to meet or use a courier to share a secret key before they could write in secret. Singh calls this the key distribution problem. With public-key cryptography, anyone can lock a message for you with your public key, and only your private key opens it.

  5. Which reader does this review suggest The Code Book suits best?
    Show answer

    A curious newcomer who wants the main ideas and stories, in print, and who checks details elsewhere. The review calls it a clear first book with many small errors, and the cipher examples and tables work best on the page.

The takeaway

The Code Book by Simon Singh tells the history of cryptography as an evolutionary arms race between codemakers and codebreakers, in which each cipher survives only until its weakness is found. The best chapters explain frequency analysis, the breaking of the Vigenère cipher and of Enigma, and the invention of public-key cryptography. Experts found many small errors, and the chapters on quantum computing are dated, so read it as a lively introduction, in print. When someone calls a system secure, ask what its weakness is.

Key quotes

“The history of codes and ciphers is the story of the centuries-old battle between codemakers and codebreakers, an intellectual arms race that has had a dramatic impact on the course of history.”
Simon Singh, The Code Book, Introduction
“The science of secrecy is largely a secret science.”
Simon Singh, The Code Book, Introduction
“The only people who are in a position to point out my errors are also those who are not at liberty to reveal them.”
Simon Singh, The Code Book, Introduction

Should you read it?

Read it if

  • You want to understand how ciphers are made and broken, with worked examples you can follow with a pencil.
  • You enjoy history told through people, such as Mary Queen of Scots, Charles Babbage and the codebreakers of Bletchley Park.
  • You want to know where the encryption in your phone and browser came from.

Skip it if

  • You need an exact technical reference: experts found many small errors, and the book ends in 1999.
  • You want current information on quantum computers or modern encryption standards.

As an Amazon Associate, mentua.org earns from qualifying purchases. It costs you nothing and never shapes the verdict.

Ideas from this book

References

  1. The Code Book. Simon Singh

    The author's page on the book, with links to reviews and to the Cipher Challenge.

  2. Cipher Challenge. Simon Singh

    The ten puzzles printed at the back of the book and the story of how a Swedish team solved them in 2000.

  3. Of riddles wrapped in Enigmas. Whitfield Diffie, Times Higher Education, 1999

    A critical review by one of the inventors of public-key cryptography, who appears in the book.

  4. Coded secrets cracked open. Artur Ekert, Physics World, 2000

    A warm review by a pioneer of quantum cryptography, who criticises the book's last chapter.

the-code-booksimon-singhcryptographycodebreakingbook-reviewsummaryfrequency-analysisvigenere-cipherenigmabletchley-parkalan-turingmarian-rejewskipublic-key-cryptographygchqpgpquantum-cryptographymary-queen-of-scotshistory-of-science

What Is Moore's Law?

Why the number of transistors on a chip doubled about every two years for half a century, and why chips stopped getting much faster around 2005.

5 min read≈ 1,200 words3 questions