back to books

The Code Book by Simon Singh

The Code Book by Simon Singh

Rating: 8/10

Date Read: July 25, 2024

Non Affiliate Link | Affiliate Link

My Thoughts

I have tried reading a few books on Cryptography in the past as this is the subject I’m somewhat interested in. Every single time I dropped the book as I was either getting bored or started to lose the grasp on what was going on. It couuld be that it was the wrong time and place to read those books, but I’m going to stick to the former.

This read like a novel. Literally. I read it before going to sleep, which is when I usually read fiction.

Simon, did a great job describing complex topics in a simple way, through excellent storytelling. Each chapter has focuses on one develpoment in the world of cryptography and on one story where this development is relevant. So, not only are you learning about cryptography, but you are also learning some history.

This is not a book that gives you many life tips and advices. You are not going to take away a lot that would be super useful in your day to day life. But, this is not why you picked up this book. You picked it up to get a gentle intro into the world of cryptography. And that job is done excellently.

Highlights

Introduction

Ever since reading The Decipherment of Linear B, John Chadwick’s description of how an ancient Mediterranean text was unraveled, I have been struck by the astounding intellectual achievements of those men and women who have been able to decipher the scripts of our ancestors, thereby allowing us to read about their civilizations, religions and everyday lives.

1 The Cipher of Mary Queen of Scots

Secret communication achieved by hiding the existence of a message is known as steganography, derived from the Greek words steganos, meaning “covered,” and graphein, meaning “to write.”

cryptography itself can be divided into two branches, known as transposition and substitution.

In transposition each letter retains its identity but changes its position, whereas in substitution each letter changes its identity but retains its position.

Caesar used secret writing so frequently that Valerius Probus wrote an entire treatise on his ciphers, which unfortunately has not survived.

The convention in cryptography is to write the plain alphabet in lower-case letters, and the cipher alphabet in capitals.

The significance of the key, as opposed to the algorithm, is an enduring principle of cryptography. It was definitively stated in 1883 by the Dutch linguist Auguste Kerckhoffs von Nieuwenhof in his book La Cryptographie militaire: “Kerckhoffs’ Principle: The security of a cryptosystem must not depend on keeping secret the crypto-algorithm. The security depends only on keeping secret the key.”

From the enemy’s point of view, if they intercept the message and suspect that the algorithm being used is the Caesar shift, then they merely have to check the 25 possibilities. However, if the sender uses the more general substitution algorithm, which permits the cipher alphabet to be any rearrangement of the plain alphabet, then there are 400,000,000,000,000,000,000,000,000 possible keys from which to choose.

The richness of Islamic culture was to a large part the result of a wealthy and peaceful society. The Abbasid caliphs were less interested than their predecessors in conquest, and instead concentrated on establishing an organized and affluent society. Lower taxes encouraged businesses to grow and gave rise to greater commerce and industry, while strict laws reduced corruption and protected the citizens.

The only European institutions to encourage the study of secret writing were the monasteries, where monks would study the Bible in search of hidden meanings, a fascination that has persisted through to modern times (see Appendix C).

Medieval monks were intrigued by the fact that the Old Testament contained deliberate and obvious examples of cryptography.

Note: 800-1200 AD

Islamic discoveries in science and mathematics strongly influenced the rebirth of science in Europe, and cryptanalysis might have been among the imported knowledge.

An equally simple development was that cryptographers would sometimes deliberately misspell words before encrypting the message.

Note: Improvements on the monoalphabetic ciphers

Technically, a code is defined as substitution at the level of words or phrases, whereas a cipher is defined as substitution at the level of letters. Hence the term encipher means to scramble a message using a cipher, while encode means to scramble a message using a code.

Figure 7 The science of secret writing and its main branches.

A nomenclator is a system of encryption that relies on a cipher alphabet, which is used to encrypt the majority of a message, and a limited list of codewords. For example, a nomenclator book might consist of a front page containing the cipher alphabet, and then a second page containing a list of codewords. Despite the addition of codewords, a nomenclator is not much more secure than a straightforward cipher, because the bulk of a message can be deciphered using frequency analysis, and the remaining encoded words can be guessed from the context.

The cipher of Mary Queen of Scots clearly demonstrates that a weak encryption can be worse than no encryption at all. Both Mary and Babington wrote explicitly about their intentions because they believed that their communications were secure, whereas if they had been communicating openly they would have referred to their plan in a more discreet manne

the misuse of a weak cipher can generate a very false sense of security.

2 Le Chiffre Indéchiffrable

The onus was clearly on the cryptographers to concoct a new, stronger cipher, something that could outwit the cryptanalysts. Although this cipher would not emerge until the end of the sixteenth century, its origins can be traced back to the fifteenth-century Florentine polymath Leon Battista Alberti. Born in 1404, Alberti was one of the leading figures of the Renaissance-a painter, composer, poet and philosopher, as well as the author of the first scientific analysis of perspective, a treatise on the housefly and a funeral oration for his dog. He is probably best known as an architect, having designed Rome’s first Trevi Fountain and having written De re aedificatoria, the first printed book on architecture, which acted as a catalyst for the transition from Gothic to Renaissance design.

Note: Fascinating person

diplomatic work. Then, at the age of thirty-nine, Vigenère decided that he had accumulated enough money for him to be able to abandon his career and concentrate on a life of study. It was only then that he examined in detail the ideas of Alberti, Trithemius and Porta, weaving them into a coherent and powerful new cipher.

Cryptographers began to insert blocks of ciphertext merely to challenge their colleagues.

In 1843, keen to exploit the interest he had generated, Poe wrote a short story about ciphers, which is widely acknowledged by professional cryptographers to be the finest piece of fictional literature on the subject. “The Gold Bug”

3 The Mechanization of Secrecy

Italian physicist Guglielmo Marconi invented an even more powerful form of telecommunication, which made the need for secure encryption even more pressing.

In 1894, Marconi began experimenting with a curious property of electrical circuits. Under certain conditions, if one circuit carried an electric current, this could induce a current in another isolated circuit some distance away. By enhancing the design of the two circuits, increasing the power and adding aerials, Marconi could soon transmit and receive pulses of information across distances of up to 2.5 km. He had invented radi

4 Cracking the Enigma

According to Peter Hilton, a fellow Bletchley codebreaker, “Alan Turing was obviously a genius, but he was an approachable, friendly genius. He was always willing to take time and trouble to explain his ideas; but he was no narrow specialist, so that his versatile thought ranged over a vast area of the exact sciences.”

An alternative strategy for cracking the Naval Enigma depended on stealing keys. One of the most intrepid plans for stealing keys was concocted by Ian Fleming, creator of James Bond and a member of Naval Intelligence during the war. He suggested crashing a captured German bomber in the English Channel, close to a German ship. The German sailors would then approach the plane to rescue their comrades, whereupon the aircrew, British pilots pretending to be German, would board the ship and capture its codebooks. These German codebooks contained the information that was required for establishing the encryption key, and because ships were often away from base for long periods, the codebooks would be valid for at least a month. By capturing such codebooks, Bletchley would be able to decipher the Naval Enigma for an entire month.

5 The Language Barrier

Perhaps this appetite for cracking ancient scripts is best summarized by Maurice Pope, the author of The Story of Decipherment: “Decipherments are by far the most glamorous achievements of scholarship. There is a touch of magic about unknown writing, especially when it comes from the remote past, and a corresponding glory is bound to attach itself to the person who first solves its mystery.”

Tags: book

The earliest hieroglyphics date back to 3000 B.C., and this form of ornate writing endured for the next three and a half thousand years. Although the elaborate symbols of hieroglyphics were ideal for the walls of majestic temples (the Greek word hieroglyphica means “sacred carvings”), they were overly complicated for keeping track of mundane transactions. Hence, evolving in parallel with hieroglyphics was hieratic, an everyday script in which each hieroglyphic symbol was replaced by a stylized representation which was quicker and easier to write. In about 600 B.C., hieratic was replaced by an even simpler script known as demotic, the name being derived from the Greek demotika meaning “popular,” which reflects its secular function. Hieroglyphics, hieratic and demotic are essentially the same script-one could almost regard them as merely different fonts.

toward the end of the fourth century A.D., within a generation, the Egyptian scripts vanished. The last datable examples of ancient Egyptian writing are to be found on the island of Philae. A hieroglyphic temple inscription was carved in A.D. 394, and a piece of demotic graffiti has been dated to A.D. 450. The spread of the Christian Church was responsible for the extinction of the Egyptian scripts, outlawing their use in order to eradicate any link with Egypt’s pagan past.

In the light of such accounts, perhaps it is not so surprising that seventeenth-century scholars attempted to decipher the hieroglyphs by interpreting each one as a whole idea. For example, in 1652 the German Jesuit priest Athanasius Kircher published a dictionary of allegorical interpretations entitled Œdipus œgyptiacus, and used it to produce a series of weird and wonderful translations. A handful of hieroglyphs, which we now know merely represent the name of the pharaoh Apries, were translated by Kircher as: “the benefits of the divine Osiris are to be procured by means of sacred ceremonies and of the chain of the Genii, in order that the benefits of the Nile may be obtained.” Today Kircher’s translations seem ludicrous, but their impact on other would-be decipherers was immense. Kircher was more than just an Egyptologist: he wrote a book on cryptography, constructed a musical fountain, invented the magic lantern (a precursor of cinema), and lowered himself into the crater of Vesuvius, earning himself the title of “father of vulcanology.” The Jesuit priest was widely acknowledged to be the most respected scholar of his age, and consequently his ideas were to influence generations of future Egyptologists.

One of the first scholars to question the prejudice that hieroglyphics was picture writing was the English prodigy and polymath Thomas Young. Born in 1773 in Milverton, Somerset, Young was able to read fluently at the age of two. By the age of fourteen he had studied Greek, Latin, French, Italian, Hebrew, Chaldean, Syriac, Samaritan, Arabic, Persian, Turkish and Ethiopic, and when he became a student at Emmanuel College, Cambridge, his brilliance gained him the sobriquet “Phenomenon Young.” At Cambridge he studied medicine, but it was said that he was interested only in the diseases, not the patients who had them. Gradually he began to concentrate more on research and less on caring for the sick.

However, there is evidence that, before 1450 B.C., Minoa was a truly independent state with its own language. It was in around 1450 B.C. that Linear B replaced Linear A, and although the two scripts look very similar, nobody has yet deciphered Linear A. Linear A therefore probably represents a distinctly different language from Linear B. It seems likely that in roughly 1450 B.C. the Mycenaeans conquered the Minoans, imposed their own language, and transformed Linear A into Linear B so that it functioned as a script for Greek.

The following year, the men decided to write an authoritative three-volume account of their work which would include a description of the decipherment, a detailed analysis of three hundred tablets, a dictionary of 630 Mycenaean words and a list of sound values for nearly all Linear B signs, as given in Table 23. Documents in Mycenaean Greek was completed in the summer of 1955, and was ready for publication in the autumn of 1956. However, a few weeks before printing, on September 6, 1956, Michael Ventris was killed. While driving home late at night on the Great North Road near Hatfield, his car collided with a truck. John Chadwick paid tribute to his colleague, a man who matched the genius of Champollion, and who also died at a tragically young age: “The work he did lives, and his name will be remembered so long as the ancient Greek language and civilization are studied.”

6 Alice and Bob Go Public

The NSA employs more mathematicians, buys more computer hardware, and intercepts more messages than any other organization in the world. It is the world leader when it comes to snooping.

Although computers transformed the implementation of ciphers, the greatest revolution in twentieth-century cryptography has been the development of techniques to overcome the problem of key distribution.

Diffie was particularly interested in the key distribution problem, and he realized that whoever could find a solution would go down in history as one of the all-time great cryptographers. Diffie was so captivated by the problem of key distribution that it became the most important entry in his special notebook entitled “Problems for an Ambitious Theory of Cryptography.”

That evening Diffie got in his car and began the 5,000 km journey to the West Coast to meet the only person who seemed to share his obsession. The alliance of Diffie and Hellman would become one of the most dynamic partnerships in cryptography.

Note: Many stories of partnerships in this book. Both where the users shared the skills and amplified their thinking and where partners were complementing their skills by bringing something to the table that the other person didn’t have.

Says Hellman:

Ralph, like us, was willing to be a fool. And the way to get to the top of the heap in terms of developing original research is to be a fool, because only fools keep trying. You have idea number 1, you get excited, and it flops. Then you have idea number 2, you get excited, and it flops. Then you have idea number 99, you get excited, and it flops. Only a fool would be excited by the 100th idea, but it might take 100 ideas before one really pays off. Unless you’re foolish enough to be continually excited, you won’t have the motivation, you won’t have the energy to carry it through. God rewards fools.

Now picture the following scenario. As before, Alice wants to send an intensely personal message to Bob. Again, she puts her secret message in an iron box, padlocks it and sends it to Bob. When the box arrives, Bob adds his own padlock and sends the box back to Alice. When Alice receives the box, it is now secured by two padlocks. She removes her own padlock, leaving just Bob’s padlock to secure the box. Finally she sends the box back to Bob. And here is the crucial difference: Bob can now open the box because it is secured only with his own padlock, to which he alone has the key.

The implications of this little story are enormous. It demonstrates that a secret message can be securely exchanged between two people without necessarily exchanging a key. For the first time we have a suggestion that key exchange might not be an inevitable part of cryptography.

Note: Using simplified metaphors can do wonders for complex problems.

Rather than visualizing clocks, mathematicians often take the shortcut of performing modular calculations according to the following recipe. First, perform the calculation in normal arithmetic. Second, if we want to know the answer in (mod x), we divide the normal answer by x and note the remainder. This remainder is the answer in (mod x).

Note: So that’s where the mod covers from!

7 Pretty Good Privacy

The PGP digital signature is based on a principle that was first developed by Whitfield Diffie and Martin Hellman. When they proposed the idea of separate public keys and private keys, they realized that, in addition to solving the key distribution problem, their invention would also provide a natural mechanism for generating e-mail signatures. In Chapter 6 we saw that the public key is for encrypting and the private key for decrypting. In fact the process can be swapped around, so that the private key is used for encrypting and the public key is used for decrypting. This mode of encryption is usually ignored because it offers no security. If Alice uses her private key to encrypt a message to Bob, then everybody can decrypt it because everybody has Alice’s public key. However, this mode of operation does verify authorship, because if Bob can decrypt a message using Alice’s public key, then it must have been encrypted using her private key-only Alice has access to her private key, so the message must have been sent by Alice.

Nothing in PGP was original-Diffie and Hellman had already thought of digital signatures and other cryptographers had used a combination of symmetric and asymmetric ciphers to speed up encryption-but Zimmermann was the first to put everything together in one easy-to-use encryption product, which was efficient enough to run on a moderately sized personal computer.

Note: There are people who innovate and people who bring innovations to the masses.

Because the U.S. Government included encryption software within its definition of munitions, along with missiles, mortars and machine guns, PGP could not be exported without a license from the State Department. In other words, Zimmermann was accused of being an arms dealer because he had exported PGP via the Internet.

In America there are no restrictions on key size, but U.S. software companies are still not allowed to export Web products that offer strong encryption. Hence, browsers exported to the rest of the world can handle only short keys, and thus offer only moderate security. In fact, if Alice is in London buying a book from a company in Chicago, her Internet transaction is a billion billion billion times less secure than a transaction by Bob in New York buying a book from the same company. Bob’s transaction is absolutely secure because his browser supports encryption with a larger key, whereas Alice’s transaction could be deciphered by a determined criminal. Fortunately, the cost of the equipment required to decipher Alice’s credit card details is vastly greater than the typical credit card limit, so such an attack is not cost-effective.

8 A Quantum Leap into the Future

Whether we adopt superposition or the many-worlds interpretation, quantum theory is a perplexing philosophy. Nevertheless, it has shown itself to be the most successful and practical scientific theory ever conceived. Besides its unique capacity to explain the result of Young’s experiment, quantum theory successfully explains many other phenomena. Only quantum theory allows physicists to calculate the consequences of nuclear reactions in power stations; only quantum theory can explain the wonders of DNA; only quantum theory explains how the sun shines; only quantum theory can be used to design the laser that reads the CDs in your stereo. Thus, like it or not, we live in a quantum world.

By placing a filter known as a Polaroid in the path of the photons, it is possible to ensure that the emerging beam of light consists of photons that vibrate in one particular direction; in other words, the photons all have the same polarization. To some extent, we can think of the Polaroid filter as a grating, and photons as matchsticks randomly scattered onto the grating. The matchsticks will slip through the grating only if they are at the correct angle. Any photon that is already polarized in the same direction as the Polaroid filter will automatically pass through it unchanged, and photons that are polarized perpendicular to the filter will be blocked.

This difficulty in measuring photons is one aspect of the uncertainty principle, developed in the 1920s by the German physicist Werner Heisenberg. He translated his highly technical proposition into a simple statement: “We cannot know, as a matter of principle, the present in all its details.” This does not mean that we cannot know everything because we do not have enough measuring equipment, or because our equipment is poorly designed. Instead, Heisenberg was stating that it is logically impossible to measure every aspect of a particular object with perfect accuracy. In this particular case, we cannot measure every aspect of the photons within the light traps with perfect accuracy. The uncertainty principle is another weird consequence of quantum theory.

Another way to think about quantum cryptography is in terms of a pack of cards rather than polarized photons.

Note: This book is great for many reasons but the strongest one imho of the user id analogies

If quantum cryptography systems can be engineered to operate over long distances, the evolution of ciphers will stop. The quest for privacy will have come to an end. The technology will be available to guarantee secure communications for governments, the military, businesses and the public.

Appendix D - The Pigpen Cipher

The monoalphabetic substitution cipher persisted through the centuries in various forms. For example, the pigpen cipher was used by Freemasons in the 1700s to keep their records private, and is still used today by schoolchildren. The cipher does not substitute one letter for another, rather it substitutes each letter for a symbol according to the following pattern.

Share

Tuesday Letter

Consider signing up for my personal newsletter. I will share the most interesting articles and resources I've encountered during the week.