Christmas Trilogy 2013 Part II: On Her Majesty’s Secret Service

From the modern standpoint Charles Babbage tends to be regarded as a one trick pony, “the father” of the computer. Now whilst it is true that Babbage’s obsession with his calculating engines played a very central role in much of his life, he actually applied his immense intelligence to a wide range of topics and projects. One of theses he seems to have regarded as a distraction as he tells us in his autobiography.

Deciphering is, in my opinion, one of the most fascinating of arts, and I fear I have wasted upon it more time than it deserves. I practised it in its simplest form when I was at school. The bigger boys made ciphers, but if I got hold of a few words, I usually found out the key. The consequence of this ingenuity was occasionally painful: the owners of the detected ciphers sometimes thrashed me, though the fault really lay in their own stupidity

Babbage was a cryptologist, and not just as a school boy, there is even some circumstantial evidence that like Alan Turing and John Wallis he served the powers that be as a code maker and breaker assisting Rear Admiral Sir Francis Beaufort, naval hydrographer and creator of the Beaufort Scale, during the Crimean War.

Babbage continued his schoolboy antics as an adult. He and his friend the physicist and inventor, Charles Wheatstone, took great pleasure in enciphering deciphering the coded messages in the classified advertisements in The Times. Wheatstone even going so far as send a new encoded message to a young lady, whose Oxford student friend had by this means proposed an elopement, telling her not to. In 1854 Babbage served as an expert witness in a law case. Enciphering Deciphering a letter sent by a Captain Childe to a mysterious lady. In the same year Babbage’s activities as a cryptologist reach a highpoint in an exchange of letters in the Journal of the Society of Arts concerning the so-called Vigenère cipher.

Named after Blaise de Vigenère by Bourbonnais, who had published it in his Traité de Chiffres in 1586 it was generally considered in the nineteenth century to be unbreakable. One of the most basic ciphers is the simple alphabetic substitution, named the Caesar cipher after Julius Caesar who is said to have used it, that most of us learn some time in primary school. In this cipher, each letter is replaced by a letter obtained by sliding one alphabet against another, e.g.



Here Renaissance Mathematicus would become Sfobjttbodf Nbuifnbujdvt.

Such a cipher is naturally fairly easy to encipher and it is obvious that anybody wanting to indulge in serious coding would need something somewhat more complex, enter the Vigenère cipher, a polyalphabetic substitution cipher. In this each letter in the original message is fed through a different one of the 26 substitution alphabets according to a predetermined scheme. The cipher was given its final twist in that the alphabets used were chosen using a keyword known to both parties. I won’t go into details but for those interested you can find a good description in the Wikipedia article.

Before returning to Babbage it should be noted that although named after Vigenère this polyalphabetic cipher was not invented by him and we find quite a collection of significant Renaissance figures involved in its history.  The Renaissance polymath Leon Battista Alberti, who famously published the first account of linear perspective, wrote the earliest known account of the Vigenère cipher using a cipher disk in 1466, which was however first published posthumously in 1568. In a book written in 1508 but first published posthumously in 1518, the Renaissance occultist Johannes Trithemius independently discovered the Vigenère cipher in his case using a cipher tableau.  In 1553 Giovanni Battista Belaso published a pamphlet introducing the use of a key and in a work published in 1563 polymath and friend of Galileo, Giovanni Battista della Porto showed that the methods of Alberti and Trithemius were one and the same. Back to Babbage.

Over the centuries various people had (re)discovered the Vigenère cipher and in 1854 John Hall Brock Thwaites, a Bristol surgeon and dentist, claimed in a letter to the Journal of the Society of Arts to have invented an unbreakable cipher, which was in fact the keyword variation of the Vigenère cipher. This was pointed out to him in an anonymous letter from Babbage, who had almost certainly been consulted by the Society of Arts. Babbage closed his letter in his usual snide manner with the following remark:

“It may be laid down as a principle that it is never worth the trouble of trying any inscrutable cypher unless its author has himself deciphered some very difficult cypher”.

Stung by Babbage’s remark Thwaites challenged Babbage, given clear and encrypted message to supply the keywords used in the encryption. In his next letter Babbage obliged by doing just that revealing Thwaites’ keywords, two combined. He also returned the original message re-encrypted and challenged Thwaites in his turn to find his keywords, foreign supremacy. Thwaites withdrew from the unequal contest. This exchange of letters revealed Babbage to be a master cryptologist but didn’t reveal his working methods.

In fact Babbage had developed a general analytical method not only for the Vigenère cipher in question, but also for even more complex variations, using modulo arithmetic, which itself had only been first published by Gauss in 1801. Had Babbage published his results they would not only confirmed his high status as a mathematician but also established him as a leading cryptologists. In fact he did plan and make preparations for just such a publication, to be entitled The Philosophy of Deciphering, but never carried through on the project. Had he done so, his book would have been the first work of mathematical analysis in cryptology.

We now move onto the highly speculative part of this story. The mathematical method for breaking the Vigenère cipher was first published in 1863 by the German army officer Major Friedrich Wilhelm Kasiski, who received the credit for it, as a result of which the method is known as Kasiski analysis or Kasiski examination. This opens the question as to why Babbage didn’t claim credit for his discovery. Enter Beaufort.

Francis Beaufort is credited with having invented a cipher known as the Beaufort cipher that is in fact another variation of the Vigenère cipher. Now one of the puzzling facts is that there are no papers amongst Beaufort’s vast archives related to cryptology in general or the Beaufort cipher in particular, whereas a variation on the Beaufort cipher can be found amongst Babbage’s cryptology papers. Did Babbage in fact supply the Beaufort cipher and did the Admiralty, through Francis Beaufort, have access to Babbage’s methodology for solving Vigenère ciphers during the Crimean War giving them the same strategic advantage that the Allies enjoyed in terms of Enigma during the Second World War thanks to Bletchley Park? There are suggestions in Babbage’s papers and correspondence that this might indeed have been the case but no conclusive evidence. Was Babbage engaged on Her Majesty’s Secret Service as a code breaker? We will probably never know for certain but it’s nice to think that he was.


Filed under History of Mathematics, History of science

9 responses to “Christmas Trilogy 2013 Part II: On Her Majesty’s Secret Service

  1. In 4th paragraph “enciphered” for “deciphered” twice.

    Re last line I thought you were against “nice to think” history!

  2. Pingback: Giant’s Shoulders #67 | Early Modern Medicine

  3. Pingback: Christmas Trilogy, what’s that? | The Renaissance Mathematicus

  4. Pingback: Weekend Reading XCX : Blogcoven

  5. araybold

    The idea of Babbage as espionage agent is an intriguing idea, but the practicality of such a scheme would depend on there being encrypted messages that could be intercepted. The telegraph was being deployed at the time, so we can imagine there being agents behind enemy lines, installing taps on unguarded wires. I wonder whether the encryption of sensitive telegraph messages was routinely practiced by then, or whether it was a time, like the present, when the general awareness of the risks lagged behind the reality?

  6. Pingback: Christmas Trilogies! | The Renaissance Mathematicus

  7. Pingback: The Trilogies of Christmas Past | The Renaissance Mathematicus

  8. Pingback: Christmas at the Renaissance Mathematicus – A guide for new readers | The Renaissance Mathematicus

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s