The Code Book: The Science of Secrecy From Ancient Egypt to Quantum Cryptography
A clear history of how secret messages have been hidden and exposed, from Caesar's alphabet shift to Enigma and prime-number keys. It traces the long contest between code makers and code breakers, with each side pushing the other to improve.

Table of Content
1. Introduction
55 sec
Encryption can feel like magic reserved for spies and engineers, yet every modern cipher grows from tricks a child could use. In The Code Book, Simon Singh traces secret writing back to the fifth century BC, when Greeks facing a constant threat from Persia needed messages an enemy could not read.
What follows is a long contest. Code makers invent a method that seems safe, code breakers find the pattern it leaks, and the losers sometimes pay with a war or a head. That is the thread here: ciphers fail through the patterns their users leave behind, and each failure pushed secrecy from language to machines to mathematics, and now toward physics.
Follow it and the locks on today’s digital messages stop being a mystery, along with the reason governments may one day keep the strongest codes away from ordinary people.
2. Hide a message by shuffling or swapping letters
1 min 30 sec
A Roman general’s favorite trick and a schoolyard zigzag share the same roots as every secret code that followed. Learning them takes a minute, and so does seeing why they could never hold out for long.
3. Every language leaves a fingerprint you can read
1 min 43 sec
A queen believed her secret letters were safe while her enemies read them line by line. The tool that betrayed her was invented centuries earlier, and it still works on anything that repeats itself.
4. Security nobody uses protects nobody
1 min 51 sec
A French scholar published a cipher in 1586 and gave it a name meaning it could never be broken. Armies mostly ignored it for two centuries, and the name turned out to be wrong too.
5. Crack an unknown script with a few known names
1 min 47 sec
Two ancient scripts defeated scholars for generations, one carved in Egypt and one pressed into clay on Crete. The people who finally read them were working from surprisingly small clues, and one was not even a linguist.
6. Perfect secrecy loses to everyday convenience
1 min 52 sec
By World War I, a cipher existed that mathematics proves can never be broken. Militaries still reached for something else, and the machine they chose looked unbeatable for very different reasons.
7. One safety habit exposed Enigma and shows you its weakness
1 min 48 sec
The Germans added a small precaution to every Enigma message to avoid mistakes. A Polish mathematician saw what it gave away, and a team in Britain turned his insight into something that changed the war.
8. Share secrets without ever sending your key
1 min 50 sec
For two thousand years, sending a secret meant first sending a key, and keys could be stolen on the way. Three cryptographers found a way around that rule, and prime numbers made the result far harder to crack.
9. What quantum computing means for your secrets
1 min 37 sec
For the first time in history, the people hiding messages seem to be winning. A new kind of computer could end that lead, and the same physics may produce codes so strong that governments want them kept out of reach.
10. Conclusion
1 min 04 sec
The Code Book reads like a long game of hide and seek in which the seekers kept winning. A Caesar shift, a queen’s nomenclature, Vigenère’s square and Enigma’s discs each looked safe to the people using them, and each fell to someone who spotted what they repeated: a common letter, a short codeword, a key typed twice, a weather report sent every morning. Only when mathematics made the work of breaking too large did the hiders pull ahead, and quantum machines may yet reopen the race.
The habits worth keeping are modest. Look at any system you trust with a secret and ask what it repeats, because repetition is what an attacker counts. Treat a perfect method nobody will use as no protection at all. And when governments argue over who may hold the strongest codes, recognize a question as old as Greece bracing for Persia.
Mary, Queen of Scots trusted a cipher she had no way to judge. Knowing how codes break is the surest way to avoid her mistake.
About this book
What is this book about?
For as long as rulers and armies have had secrets, someone has been trying to read them. Simon Singh tells the story of that contest, from Greeks fearing a Persian conquest in the fifth century BC to physicists sending photons through fiber optic cable. Along the way, a weak cipher costs Mary, Queen of Scots her head and a German safety habit hands the Allies the Enigma code. Singh's angle is the arms race itself. Each new method looks safe until a code breaker finds what it repeats: a common letter, a short codeword, a key typed twice, a weather report sent every morning. Each break forces a stronger method, and the field moves from language and linguists to machines, then to mathematicians and the hard arithmetic of prime numbers. Readers come out understanding how substitution ciphers, frequency analysis, the one-time pad, Enigma, DES, RSA and key exchange actually work, explained without formulas. They also see where the contest is heading, with quantum computers threatening today's codes and quantum keys promising ones so secure that governments may not let ordinary people use them.
Book Information
Who it's for
Professionals using encryption
Curious professionals who use encryption every day and want to understand how it actually works.
History and WWII fans
History and World War II readers drawn to the Enigma story and the people who cracked it.
Math and computing students
Students of mathematics or computing looking for the human story behind prime numbers and keys.
About the Author
Simon Singh
Simon Singh, born in 1964, earned a PhD at Cambridge and spent 1991 to 1997 at the BBC, where he produced Tomorrow's World. His other books include Fermat's Last Theorem, Big Bang and Trick or Treatment? The Code Book, written in 1999, became an international bestseller and inspired the Channel 4 series The Science of Secrecy. In 2012 he founded the Good Thinking Society, which created Parallel, a website helping students learn mathematics. He co-founded the Undergraduate Ambassadors Scheme and is a trustee of the National Museum of Science and Industry.
Ratings & Reviews
Ratings at a glance
What people think
Listeners find this work enthralling from beginning to end, featuring a comprehensive history of ciphers and codes organized chronologically. Technical elements are broken down clearly, rendering intricate mathematical theories easy to understand, and listeners value the book’s educational benefits, especially for children. The prose is described as fascinating, with listeners enjoying the compelling narratives about the world of cryptography. While some listeners find the material quite absorbing, others note that the book has a slow start.
Top reviews
Wow. I never expected a book about mathematics and linguistics to read like a high-stakes espionage thriller, but Simon Singh absolutely nailed the execution. The way he weaves the historical tragedy of Mary Queen of Scots into the actual mechanics of her broken cipher makes the theory feel incredibly tangible. It's essentially geek porn for anyone who loves puzzles, yet it remains perfectly accessible for those of us who aren't math whizzes. I particularly loved the section on the Enigma machine and the geniuses at Bletchley Park; it really puts the 'nerd' in historical perspective. Singh strikes a brilliant balance between technical explanation and human drama. You leave the book not just knowing how codes work, but understanding why they changed the course of every major war. This is a must-read for anyone curious about the secret history of the world.
Show moreEver wonder how your credit card information stays safe in a world full of hackers? This book provides the definitive answer by tracing the thousand-year arms race between code-makers and code-breakers. Singh’s writing style is fascinating, turning what could have been a dry textbook into a series of interconnected mysteries. The chapter on the Navajo Code Talkers was a revelation, highlighting a unique piece of American history I hadn't fully appreciated before. It’s rare to find an author who can handle both the physics of quantum cryptography and the linguistics of Egyptian hieroglyphics with equal grace. Personally, the 'Cipher Challenge' at the end was a fun, if humbling, addition that shows just how difficult this craft really is. If you have even a passing interest in history or technology, you need to pick this up. It’s easily one of the best non-fiction books I’ve encountered in years.
Show moreFinally got around to reading this classic, and it’s striking how much of our modern privacy debate was already being framed by Singh twenty years ago. The sections on Phil Zimmermann and PGP are especially relevant today as we continue to argue about encryption backdoors and government surveillance. Singh manages to explain the RSA algorithm without losing the reader in a sea of prime numbers, which is no small feat. I was particularly captivated by the transition from mechanical ciphers to the digital age. The narrative is fast-paced and the historical anecdotes are chosen perfectly to illustrate each new advancement in the field. It’s the kind of book that makes you look at your computer and your phone in a completely different light. Even though the technology has advanced since publication, the fundamental principles Singh explains remain the bedrock of our digital lives. Simply brilliant.
Show moreAfter hearing so much about the 'Enigma' movie, I wanted to dive into the real history behind it, and this book delivered exactly what I needed. Simon Singh is the gold standard for popular science writing. He has this incredible ability to take a daunting subject like quantum teleportation and explain it using analogies that actually make sense to a normal person. The book is organized chronologically, which helps you see the evolution of thought as each 'unbreakable' code is eventually shattered by a cleverer opponent. The stakes felt real in every chapter, from the fate of empires to the privacy of our personal emails. It's rare to find a book that is this educational while still being a genuine page-turner. I’ve already recommended it to three people this week. If you like history, science, or just a good story about human ingenuity, this is it.
Show morePicked this up for a reading challenge about topics I knew nothing about, and I ended up finishing it in three days. I was absolutely hooked by the way Singh describes the 'Black Chambers' and the early days of postal interception. It’s a fascinating look at how governments have always tried to stay one step ahead of their citizens. The explanations of the Vigenère square and other classic ciphers were so clear that I actually started making my own codes in the margins. It’s a perfect mix of history and practical science. Singh's enthusiasm for the subject is infectious, and he makes you feel the same rush the code-breakers felt when they finally saw a message emerge from the gibberish. This is easily one of the most engaging non-fiction books on my shelf. I’ll definitely be checking out his other work, like the one on Fermat’s Last Theorem.
Show moreAs a self-proclaimed math-phobe, I was genuinely terrified when I first flipped through and saw pages filled with tables and comma-separated numbers. To be fair, some of the technical descriptions toward the end of the book required me to slow down and reread a few paragraphs to really grasp the logic. However, Singh has a gift for making complex concepts like public-key cryptography feel like a simple logic puzzle. He doesn't just throw equations at you; he explains the 'why' before the 'how.' The chronological flow is excellent, starting with ancient methods like tattooed heads and moving through to the quantum future. My only real gripe is that the middle sections on 18th-century ciphers felt a bit repetitive compared to the high-octane stories of the World Wars. Still, it's an incredibly rewarding read that makes you feel smarter by the final page.
Show moreThe chapter on the decipherment of Egyptian hieroglyphics was an unexpected highlight in a book supposedly about secret agents and military codes. Singh makes a compelling case for why breaking an ancient dead language is essentially the same intellectual exercise as cracking a wartime code. I appreciated how he stepped away from the math to focus on the human obsession with secrecy and the thrill of discovery. My only minor criticism is that the book shows its age slightly when discussing the future of the internet, but the historical sections are timeless. The writing is clear and the diagrams are actually helpful rather than just being filler. It’s a great choice for kids who are into puzzles or adults who want a thorough history of information warfare. Not every chapter is a page-turner, but the overall journey is well worth the time invested.
Show morePersonally, my favorite part was the section devoted to the role cryptography played in the development of the telegraph. It’s easy to forget that the need for privacy isn't just a digital-age problem; it was a major commercial driver back in the 1800s too. Singh does a great job of showing how technology and secrecy have always been intertwined. The book is quite thorough, maybe a bit too thorough in the middle sections, but the payoff at the end regarding quantum computers is fascinating. I did find the writing to be a bit dry in the more academic passages, but the anecdotes about characters like Alan Turing more than make up for it. It’s a heavy book with a lot of information to digest, so don't expect to fly through it in one sitting. Take your time with the puzzles and the logic—it’s much more satisfying that way.
Show moreLook, I wanted to love this more than I did, but the truth is that it starts quite slowly. The first few chapters on ancient ciphers felt like a bit of a slog through elementary history that I'd already seen elsewhere. I found myself skimming the more theoretical descriptions of substitution ciphers just to get to the 'good stuff' in the twentieth century. Once Singh gets into the Enigma and the development of the computer, the pacing improves dramatically and the stakes feel much higher. The technical details are well-explained, but there were moments where the sheer volume of names and dates became overwhelming. It’s definitely an educational value-add for your bookshelf, but be prepared for some dry patches in the beginning. It’s a solid reference work, though perhaps a bit too dense for a casual weekend read if you aren't already into the subject matter.
Show moreFrankly, I found the technical depth of this book to be a bit much for a layman. While the Amazon summary promises a 'captivating' history, I found myself getting lost in the weeds of modular arithmetic and frequency analysis. It felt less like a story and more like a very long lecture that I wasn't quite prepared for. There were far too many charts and tables for my liking, and they often interrupted the flow of the historical narrative. If you don't have a natural affinity for mathematics, you might find yourself curling into a ball like I did. I understand the importance of the subject, but the abstract nature of the later chapters made it hard to stay engaged. I was hoping for more 'cloak and dagger' and less 'numbers and junk.' This one just wasn't for me, though I can see why die-hard math enthusiasts would enjoy it.
Show moreQuestions about this book
What is The Code Book by Simon Singh about?
It is a history of cryptography, the art of hiding the meaning of messages, and of the code breakers who fought it. Singh follows the contest from ancient Greece and Julius Caesar through Mary, Queen of Scots, the Vigenère cipher and Enigma to computer encryption and quantum cryptography. His running theme is an arms race: every cipher eventually leaks a pattern, and each break forces a stronger method.
How was the Enigma code broken?
German operators typed each three-letter message key twice to avoid errors. Polish mathematician Marian Rejewski used that repetition to catalog all 105,456 scrambler settings within a year. At Bletchley Park, Alan Turing and his team found other patterns, such as the cipher word for weather in daily reports, and mechanized Rejewski’s cataloging by linking Enigmas electrically. Their work gave the Allies warning of bombing raids and details of the forces at Normandy.
What is frequency analysis in cryptography?
Frequency analysis, invented by Arab cryptanalysts around 750 AD, cracks ciphers that swap one letter for another. Every language uses some letters more than others; in English, E is most common, followed by letters such as T, A, O, N, S and R. A code breaker counts the symbols in a message, matches the most frequent ones to the most common letters and fills in the rest from the partial words that appear.
Why does Singh think governments may restrict new encryption?
Singh explains that modern ciphers like DES and RSA already outpace code breakers, and quantum physics could make codes stronger still. Photons can produce perfectly random keys for the one-time pad and show quickly when someone tries to intercept them. Ciphers that secure, he suggests, might be forbidden to the public and potential criminals alike, turning the contest between code makers and breakers into a political one.
What practical lessons does The Code Book offer?
The history suggests a few. Any secret system that repeats itself gives an observer something to count, as Mary, Queen of Scots and Enigma’s operators learned. A secure method that is too slow or awkward gets ignored, which is why armies passed over the Vigenère cipher and the one-time pad. And the safest approach avoids handing over a key at all, the idea behind the Diffie-Hellman-Merkle exchange.
Readers also enjoyed
AI 2041: Ten Visions for Our Future
Kai-Fu Lee
A Splendid Exchange: How Trade Shaped the World
William J. Bernstein
A Spy Among Friends: Philby and the Great Betrayal
Ben Macintyre
AUDIO SUMMARY AVAILABLE
Listen to The Code Book in 15 minutes
Get the key ideas from The Code Book by Simon Singh, plus 5,000+ more nonfiction titles.
- 5,000+ titles
- Listen as much as you want
- 7-day free trial
- Cancel anytime



















