Prelude

When I was young, I was deeply inquisitive. My dad worked for a bank, and would bring home broken dictaphones and green-screen monitors, with a view to one day fixing them. Needless to say he never did, and so I was given the chance to fiddle and play with the retro-tech in my bedroom.

After the initial novelty of recording my own voice and playing it back had worn off I began to be more interested in asking "How?". How does this thing work? How does it do that? How can I make it do something else? This usually involved raiding my dad's toolbox for flathead and Philips screwdrivers.

Once I had taken a device apart, I'd inevitably want to get it back together… and that rather relied on me still having all the screws left (most of which had been lost in the carpet weave of my bedroom, hidden waiting for me to stand in it later!). I quickly gained an appreciation for electrical and mechanical engineering, and it's from this foundation that my curiosity for computing science, information security and cryptography grew.

In this short series of posts I will guide you to understand in simple terms how some basic mathematical principles are being used to protect our modern fast-paced lives. From the encryption of files on your hard drive to conducting business with your online retailer or bank. I'll also give you a glimpse at what lies on the path ahead of us in terms of research and applications of cryptography.

While I will try to make my descriptions and explanations as accessible as possible, cryptography can be quite confusing. Where the topics skirt fringes of anything one might need a degree in Mathematics to understand, I may glaze over, and ask you to simply accept them as truth… after all we may end up unbuttoning the universe if we're not careful!

Symmetric Cryptography

If I talk about encryption or secret messages, usually what you would normally think of is Symmetric Key Cryptography. Symmetric Key Cryptography describes algorithms, ciphers and schemes that make use of a single secret (or "key") to both encrypt and decrypt a message. An example of a fairly simple cipher that fits into this is the Caesar Cipher.

I came. I saw. I conquered.

Julius Caesar is recorded as having used this scheme for transmission of military communications, but given that most people to whom intercepting the message would have been useful were also illiterate, it was a little bit pointless. Regardless, Caesar valued his privacy and ability to communicate in secret, and so used the following scheme.

To encrypt a message using the Caesar Cipher you need to shift your alphabet forwards or backwards by a set number of characters from their normal position. You then use this as the substitution between your plaintext (the message you want to communicate) and your ciphertext (the gibberish that you want to give to your messenger).

To decrypt the ciphertext, the recipient of your message has to do the same operation, but backwards. This operation then recovers the plaintext message you originally encrypted.

Example Time

So, say we were to shift our standard English alphabet right by 3 characters:

 

Where we want to encrypt the letter "K", we look "K" up in the plaintext line, and then look down to the key, and record the "h" as our ciphertext value.

A message such as "THE DIE IS CAST" would become "qeb afb fp zxpq" for example.

The Caesar Cipher suffers with several issues that mean it probably wouldn't resist very long against a persistent or motivated attacker:

1) Since the same key is used to encrypt and decrypt, all the security of your message is built into the security of the key. If the key is leaked then an attacker or interceptor could both read and alter the message without you or the intended recipient of your message being any the wiser.

2) The ciphertext retains the structure of the plaintext. So while I may not know what "qeb" is, I do know that it's a 3 letter word, and everywhere I see "qeb" it translates to the same word.

3) If there is enough ciphertext an attacker could use the frequency of letters in the ciphertext along with the frequency of letters in the source language to make educated guesses at the translation. They'd only need to get two or three of these right to validate the correct shift value.

4) You only have to try 25 different shifts to guess the correct shift value. This is called brute-forcing, and is the last resort for cracking modern cipher schemes, as it's very labour intensive.

Chaotic Machines of War

The Caesar Cipher met the requirements of the time. It needed to be possible to encrypt and decrypt without the use of a computer, and needed to encrypt written messages. With the introduction of electrical and mechanical engineering came more complex requirements for communications. And where you wanted to keep these communications secret, you had to develop machines to help you. However even the famed Enigma cipher used by the German forces during WWII suffered from some of the same issues as the Caesar Cipher, it just used a much more complex method of scrambling, which meant that the British intelligence forces needed to apply clever schemes to shortcut some of their brute-forcing efforts.

For its time Enigma represented the pinnacle of modern cryptography, however it used several techniques similar to Caesar Cipher to achieve its complexity. Mechanical rotors were used that substituted, via an electronic pairing, one letter for another in much the same way as described above in the Caesar Cipher, but rather than a 'shift' in the alphabet the ordering of the alphabet was entirely scrambled. These rotors, each with a different scrambling configuration, and labelled so that they could be re-ordered, were then assembled in series (up to 8 in total in some Enigma variations) such that once one rotor had substituted one letter for another, the next wheel would do yet another scrambling… and so forth.

 Cryptography image

At the end of the sequence was a reflector board, which sent the now thoroughly messed up circuit back down the rotors for another series of scrambling.

To combat frequency attacks against the ciphertext, each time a key was pushed on the Enigma machine, the rotors would slowly increment against each other, creating another scrambling circuit that would be used to encrypt the next letter.

Cryptography image

 

Finally, and in addition to all this complexity, there were additional plug board configurations that would be used to further scramble the final signal for transmission by morse, making the task of recovering the plaintext only possible where the same initial rotor and plug board configuration were used.

The allied forces really had their work cut out, since the rotor and plug board configurations were changed on a daily schedule meaning that if they were only able to crack the key for Monday on the following Friday, they would only be able to decrypt messages they'd recorded on Monday. Troops and assets would have moved significantly since then, making that intelligence largely irrelevant.

Interestingly though Enigma machine operators were required to transmit on a schedule, regardless of whether there was a communication they needed to make or not. This technique was used so that the allied forces could not make use of the fact there was more or less 'chatter' to indicate more or less tactical or strategic movement in assets.

One of the radio operators at Bletchley Park noticed that none of the communications they were recording for later analysis from one such Enigma machine operator radio station contained the letter "M". They remarked on this unusual observation to a colleague and ultimately this fact was used to help crack the Enigma code.  You see, in the Enigma design, your plaintext character is never translated to the same character in ciphertext. i.e. "M" is never substituted for "M".

So where the Enigma operator was transmitting long radio communications with no "M", the allies could make the safe assumption that the operator was bored and was simply hitting the "M" key repeatedly. This knowledge alone was sufficient in assisting the Station-X team in understanding the configuration being used by other Enigma operators, and thus were able to decrypt those communications, and others using the same configuration.

Next Time…

In part two of this series we move into the digital age and see how our use of computers to communicate meant we needed to develop new techniques for securing communications.

Security