Updated: May 18
For as long as humans have been communicating through writing, we have been finding ways to disguise these messages, and ensure they’re not intercepted and read by the people we’re keeping secrets from. There are two main ways we have approached this, through Stenography - hiding the actual message and ensuring it isn’t intercepted when it is being delivered - and Cryptography - encoding the message to make the actual writing illegible to anyone who doesn’t have the code, in the event that the message is intercepted. As cryptography has developed throughout history, cryptanalysis – the art of breaking and decoding messages – has been right behind it. Mathematicians and problem-solvers have played a key role on both sides of the story throughout History, with code-breakers working on the cracking each new cypher as it came along through a mix of creativity and scientific analysis. In this article, we’re going to have a look at the efforts Mary Queen of Scots went to to keep her communications secret, and the development of cryptanalysis that eventually led to her discovery and execution.
Mary Queen of Scots had an interesting life, becoming Queen of Scotland at only 6 days old when she was born at Linlithgow Palace in Scotland on 8 December in 1542. In June 1566, Mary gave birth to James, who would eventually become King of Scotland and England, after both his mother and Queen Elizabeth had died. Mary was Queen of Scotland until 1567 when she was forced to give up her throne to her son. Catholic Mary Queen of Scots was imprisoned, as ordered by Protestant Queen Elizabeth, after she was forced to abdicate and flee Scotland after her husband was murdered. She fled to England, but was imprisoned by Queen Elizabeth who was concerned about her claim on the English throne, and the support she was gaining from the persecuted Catholics.
While imprisoned, Mary Queen of Scots was in communication with a man called Anthony Babington, a Catholic who viewed Mary as a chance for Catholicism to return to England. In 1586, they communicated in secret, encoded letters, and began to talk of plans to overthrow Queen Elizabeth. They employed stenography in an attempt to keep their messages secret, hiding their letters in beer barrels, and encrypted their messages with a system Mary had come up with.
Mary had invented a sophisticated cypher system called substitution to encrypt their messages. Her system involved substituting the letters of the message she wanted to communicate, the plain-text (i.e. the message when it is readable, before it has been encrypted), with symbols according to a key she’d written. She changed the key regularly to avoid it being discovered, and she also had symbols to represent mention of the people she talked about, including Queen Elizabeth. The idea behind the substitution method was that the message would be unreadable to anyone who didn’t have copy of the key to decode it once the message had reached the end of its journey.
However, although Mary was unaware of it, her messages were being intercepted by Sir Francis Walsingham, English diplomat and principal secretary to Queen Elizabeth. He was determined to find a reason to have Mary executed to ensure England was protected from Catholics, and he had built a large network of spies who had watched Mary for nearly 20 years. It was one of his spies who had suggested to Mary that she hide her messages in the beer barrels, so while Mary thought her letters were being successfully smuggled out, they were being delivered directly to Walsingham. However, Walsingham still had a problem, as the letters were still unreadable due to the encryption methods. This is where cryptanalysis came into play.
Although the substitution cypher appears to make the messages unreadable initially, it only disguises the message, and doesn’t change the structure of the language or words used. Thomas Phelippes, an English linguist who led the team of code-breakers who were working to decipher Mary’s messages, realized that the symbols would follow the same frequency distribution as the English letters in a plain-text message. He realized that if he counted the frequency of the symbols used, the more popular symbols should, on average, align to the more popular English letters. Once he’d identified some possible letters and their respective symbols, he could attempt to use this information to identify some more common words, and then use this information to find the letters respective to the other symbols in the encrypted word.
This relied on the fact that within any language, including English, each letter has its own personality that can be spotted through an encryption. For example, e is the most commonly occurring letter in the English language, occurring 12% of the time, meaning that just over 1/10th of the letters in a message are likely to be e. The next most common language in the English language is t, occurring 9% of the time. We can also analyze double letters, as only a few letters occur as doubles, with SS, EE, TT, OO and FF being most common. (Side note – in a more advanced version of the substitution cypher, we can assign a letter a different symbol if the letter is the second in a double, allowing the double letters to be more effectively disguised). This form of cryptanalysis became known as frequency analysis, and meant that substitution cyphers were no longer secure.
The treasonous plot that Mary had agreed to, to overthrow Queen Elizabeth, was discovered and the evidence presented to Queen Elizabeth. Although reluctant, Queen Elizabeth was finally convinced to sign Mary Queen of Scots’ death warrant. Mary Queen of Scots was finally executed in 1587, aged just 44, after almost 20 years of imprisonment.
As Singh said in The Code Book, ‘A weak encryption can be worse than no encryption at all’, and we can see why. The false security that Mary Queen of Scots felt, that her messages couldn’t be intercepted and read, eventually provided evidence of the treason she was planning and led to her execution. We can see that the battle between cryptography and cryptanalysis, that’s still ongoing today, has a large impact on the world we live in, as without the successful decryption of the plot to overthrow Queen Elizabeth, who knows how different things might have been.