·4 min read

Alan Turing and the Enigma Code

Alan Turing

Sometimes its the very people who no one imagines anything of, who do the things that no one can imagine — Alan Turing

Britain was on the verge of losing the war against Germany during the Second World War. Though, they had one hope of winning it by breaking into German communications by cracking the Enigma code with which the broadcasts of the Germans were encrypted.

In the mid-twentieth century, Arthur Scherbius developed a cipher machine that encrypts and decrypts messages called the Enigma Machine. It was used to protect commercial, diplomatic and military communications and was extensively used by Germany during the Second World War. Germans had a strong belief that the Enigma Machine gave them a huge advantage in communicating securely. They even used it for enciphering top-secret messages.

The Enigma Machine

The Enigma machine is made of combinations of mechanical and electrical subsystems. The electromechanical rotor mechanism consisted of electrical pathways, rotors, reflectors, plugboard, and entry wheel.

The Enigma Machine

The message to be enciphered was typed on the Enigma's keyboard and another person would write down which of the 26 lights above the keyboard lit up at each keypress. This way the plain text entered would turn into the encoded ciphertext. This also worked in reverse — entering the ciphertext would produce the plain text, decrypting the message.

The rotor mechanism changed the electrical connections between the keys and the lights with each keypress. Therefore, even pressing the same letter twice would result in two different ciphertext letters. For example, "AA" could turn into "JQ" or "PN".

To make the system even more secure, the machine settings were changed daily during the war based on secret-key lists distributed in advance. The receiving station had to know and use the exact settings employed by the transmitting station to successfully decrypt a message.

Why Was It "Unbreakable"?

Combining the three rotors from a set of five, each of the 3 rotor settings with 26 positions, with the plugboard with ten pairs of letters connected, the Enigma machine produced 158,962,555,217,826,360,000 possible combinations — nearly 159 quintillion.

(5 × 4 × 3) × (26³) × [26! / (6! × 10! × 2¹⁰)] = 158,962,555,217,826,360,000 possible combinations

This was the major reason it was thought to be impossible to crack. Remember, these were the times before computers — it would be a major challenge for cryptographers to manually try cracking the code in limited time, especially since the settings changed daily.

Here's a cipher text you can try to decrypt yourself:

jdmnb faure jpdic yytmn bedf

You can try decrypting it using an online Enigma Machine simulator.

Turing and the Bombe

During the Second World War, Alan Turing worked for the Government Code and Cypher School at Bletchley Park — Britain's codebreaking center that produced Ultra Intelligence. For a time he led Hut 8, the section responsible for German Naval Cryptanalysis.

Within weeks after arriving at Bletchley Park, Turing specified an electromechanical machine called the Bombe.

The Bombe Machine at Bletchley Park

The Bombe searched for possible correct settings used for the Enigma message — the rotor order, rotor settings, and plugboard settings — using cribs (known plain text and its encrypted version). For each possible setting of the rotors, the Bombe performed a chain of logical deductions based on the crib, implemented electromechanically.

The team at Bletchley Park was able to guess some of the plaintext based upon when the message was sent and by recognizing routine operational messages. For instance, the daily weather report would be sent at the same time regularly and would contain the word "Wetter" (German for weather) at the same location in every message. Many operators would send standard salutations, and "Heil Hitler" at the end of messages was common.

The Impact

This helped the British decrypt German broadcasts and gave them a major advantage in the war. Turing played a crucial role in cracking intercepted coded messages that enabled the Allies to defeat the Nazis in many crucial engagements, including the Battle of the Atlantic.

Professor Jack Copeland estimated that Turing's work shortened the war in Europe by more than two years and saved over 14 million lives.

Alan Turing is regarded as the Father of Computer Science for his major contributions to the field. He is widely known for the Turing Machine, Turing Test, Turing Patterns, and much more. There's a movie about Turing's life called the Imitation Game starring Benedict Cumberbatch — definitely worth watching.