The Code Book

Simon Singh’s The Code Book proves, once again, that he is a superlatively skilled writer on technical and scientific subjects. Thanks to his book, I now actually understand how Enigma worked and how it was broken: likewise, the Vigenere Cipher that has been built into this site for so long. This book manages to capture both major reasons for which cryptography is so fascinating: the technical aspects, centred around the ingenuity of the methods themselves, and the historical dramas connected, from the execution of Mary Queen of Scots to the use of ULTRA intelligence during the Second World War.

Anybody who has any interest in code-making or code-breaking should read this book, unless they already know so much about the subject as to make Singh’s clear and comprehensible explanations superfluous. Even then, it may arm them with valuable tools for explaining interesting concepts to the less well initiated.

At the end of the book is a series of ten ciphers for the reader to break. Originally, there was a £15,000 prize for the first person to crack the lot. Now, they exist for the amusement of amateur cryptologists. I doubt very much I will get through all ten, but I am giving it a try. The first ciphertext is on his website and is helpfully labeled ‘Simple Monoalphabetic Substitution Cipher.’ I expect to crack it quickly.

[Update: Six minutes later] I’ve got it:

in the same hour came forth fingers of a man’s hand, and wrote over against the candlestick upon the plaster of the wall of the king’s palace; and the king saw the part of the hand that wrote. then the king’s countenance was changed, and his thoughts troubled him, so that the joints of his loins were loosed, and his knees smote one against another. the king cried aloud to bring in the astrologers, the chaldeans, and the soothsayers. and the king spake, and said to the wise men of babylon, whosoever shall read this writing, and show me the interpretation thereof, shall be clothed with scarlet, and have a chain of gold about his neck, and shall be the third ruler in the kingdom. then came in all the king’s wise men; but they could not read the writing, nor make known to the king the interpretation thereof. then was king belshazzar greatly troubled, and his countenance was changed in him, and his lords were astonished. now the queen, by reason of the words of the king and his lords, came into the banquet house; and the queen spake and said, o king, live forever; let not thy thoughts trouble thee, nor let thy countenance be changed; there is a man in thy kingdom, in whom is the spirit of the holy gods; and in the days of thy father light and understanding and wisdom, like the wisdom of the gods, was found in him; whom the king nebuchadnezzar thy father, the king, i say, thy father, made master of the magicians, astrologers, chaldeans, and soothsayers; forasmuch as an excellent spirit, and knowledge, and understanding, interpreting of dreams, and showing of hard sentences, and dissolving of doubts, were found in the same daniel, whom the king named belteshazzar; now let daniel be called, and he will show the interpretation. the first codeword is othello

I didn’t even need to check letter frequencies. I just guessed about which sequence was ‘the’ and worked from there. I will save the next cipher for later.

[Update: 14 August 2007] I have been at it for less than a day and I have already solved the three easiest ciphers: 1, 2, and 4. I will give 3 a try next.

Author: Milan

In the spring of 2005, I graduated from the University of British Columbia with a degree in International Relations and a general focus in the area of environmental politics. In the fall of 2005, I began reading for an M.Phil in IR at Wadham College, Oxford. Outside school, I am very interested in photography, writing, and the outdoors. I am writing this blog to keep in touch with friends and family around the world, provide a more personal view of graduate student life in Oxford, and pass on some lessons I've learned here.

22 thoughts on “The Code Book

  1. I have cracked the second cipher in Singh’s series:


    decodes to:


    This translates roughly to:

    “Each man is the smith of his own fortune.”

  2. Singh’s cipher challenge itself seems to have produced some intrigue:

    Code Book code setters reveal crypto cock-up

    “I really didn’t have the foggiest idea how long it would take to be solved, but I think a year is a good time. If it had gone on for longer, say five years or so, it would have become frustrating and lost its pace. It is very hard to set a cipher that isn’t either trivial or impossible,” said Singh, thoughts echoed by his colleague in this endeavour, Paul Leyland.

  3. Over lunch, I was working on the fourth cipher in Singh’s series. It is dramatically tougher than the first two.

    It is a Vigenere cipher, so cracking it means doing a series of things:

    1) Finding repeated sequences and counting how far apart they are

    2) Finding the prime factors of those numbers

    3) Trying to guess the length of the key

    4) Trying to work out what shift is required for each of the monoalphabetic ciphers produced by each letter of the key.

    I have completed 1 and 2. 3 is proving pretty tricky. There are a lot of repeated sections and a lot of common factors. I doubt it would be as short as three or four characters. Other strong possibilities include a 5, 8, or 11 letter key.

    I will keep trying after work.

  4. I cracked it.

    This one is in French:


    The keytext is “SCUBA” as in Self-Contained Underwater Breathing Apparatus

  5. Cleaned up, it becomes:

    Charles Baudelaire

    Souvent, pour s’amuser, les hommes d’équipage
    Prennent des albatros, vastes oiseaux des mers,
    Qui suivent, indolents compagnons de voyage,
    Le navire glissant sur les gouffres amers.

    A peine les ont-ils déposés sur les planches,
    Que ces rois de l’azur, maladroits et honteux,
    Laissent piteusement leurs grandes ailes blanches
    Comme des avirons traîner à côté d’eux.

    Ce voyageur ailé, comme il est gauche et veule!
    Lui, naguère si beau, qu’il est comique et laid!
    L’un agace son bec avec un brûle-gueule,
    L’autre mime, en boitant, l’infirme qui volait!

    Le Poète est semblable au prince des nuées
    Qui hante la tempête et se rit de l’archer;
    Exilé sur le sol au milieu des huées,
    Ses ailes de géant l’empêchent de marcher.

    I got the nicer version from this page.

  6. It was very helpful that the first two letters “KQ” were repeated at 60, 95, and 220.

    Factor those:

    2 * 2 * 3 * 5
    5 * 19
    2 * 2 * 5 * 11

    See the common factor? That’s how you get the length of the key. After that, it’s just a matter of working our the Caesar shift for each of the five intermixed monoalphabetic ciphers.

  7. Oh, and it is definitely a good thing that letter frequencies in English and French are not too different. In particular, the common love of the letter ‘e’ made finding SCUBA much easier than it would otherwise have been.

  8. Given that is is a book cipher, the +1 and +2 are probably for X and Y.

    You don’t find many words beginning with them.

  9. Public Invited to Try Their Luck Against Old Cipher Tech

    By ScuttleMonkey on squeamish-ossifrage

    Stony Stevenson writes to tell us that in celebration of the opening of the National Museum of Computing, members of the public are being challenged to take on a rebuilt version of Colossus, the world’s first programmable digital computer. The Cipher Challenge will take two groups of amateur code breakers and pit them against one of the original Lorenz cipher machine used by the German High Command during World War II. “The encrypted teleprinter message will be transmitted by radio from colleagues in Paderborn, Germany, and intercepted at Bletchley Park by the two code-breaking groups, one using modern PCs and the other using the newly rebuilt Colossus Mark II.”


  10. Unterseeboot 110

    Unterseeboot 110 (U-110) was a Type IXB submarine of the Kriegsmarine, captured by the Royal Navy on 9 May 1941, at which point a number of secret cipher documents were recovered. U-110’s capture was later given the code word Operation Primrose and was one of the biggest secrets of the war. It remained secret for seven months. President Franklin D. Roosevelt was only told by Winston Churchill in January 1942.

  11. Pingback: The Code-Breakers
  12. How Poles cracked Nazi Enigma secret

    By Laurence Peter
    BBC News

    A silk scarf bearing the image of a horse race was a suitably cryptic gift for a Polish mathematician to receive from a British code-breaker.

    The Poles had got there first – that seemed to be the message.

    Dillwyn “Dilly” Knox was delighted with the Polish copy of an Enigma – a top secret German military cipher machine.

    But his meeting with code breakers in Poland in July 1939 – just weeks before Hitler invaded their country – had initially put him in a sour mood. He had been struggling to figure out the machine’s wiring – a key part of the complex jigsaw puzzle called Enigma.

    Marian Rejewski, a talented Polish mathematician, had guessed correctly that the wiring connections between the machine’s keyboard and encoding mechanism were simply in alphabetical order.

    Of course, there were numerous other problems to solve, but Rejewski had made a major breakthrough, by devising equations to match permutations in the machine’s settings.

  13. A 12-million-digit prime number, the largest such number ever discovered, has landed a voluntary math research group a $100,000 prize from the Electronic Frontier Foundation (EFF). The number, known as a Mersenne prime, is the 45th known Mersenne prime, written shorthand as 2 to the power of 43,112,609, minus 1 . A Mersenne number is a positive integer that is one less than a power of two, the group stated. The computing project called the Great Internet Mersenne Prime Search (GIMPS) made the discovery on a computer at the University of California, Los Angeles (UCLA) Mathematics Department.”

  14. Sculptor Gives a Hint For CIA’s Kryptos

    “The New York Times reports that Jim Sanborn, the sculptor who created the wavy metal pane called Kryptos that sits in front of the CIA in Langley, VA, has gotten tired of waiting for code-breakers to decode the last of the four messages. ‘I assumed the code would be cracked in a fairly short time,’ [Sanborn] said, adding that the intrusions on his life from people who think they have solved his fourth puzzle are more than he expected. So now, after 20 years, Mr. Sanborn is nudging the process along. He has provided The New York Times with the answers to six letters in the sculpture’s final passage. The characters that are the 64th through 69th in the final series on the sculpture read NYPVTT. When deciphered, they read BERLIN.”

Leave a Reply

Your email address will not be published. Required fields are marked *