The Imitation Game: How Did The Enigma Machine Work?

Table of Contents (click to expand)

The Enigma Machine encrypted text by sending each keypress through a plugboard, an entry wheel, three (or, on the Kriegsmarine M4, four) rotating rotors and a reflector, then back through the rotors and out to a lampboard. The fast rotor stepped one position with every keystroke, so the same letter mapped to a different cipher letter each time. With a 5-rotor set and a 10-pair plugboard, the Wehrmacht Enigma had about 159 million million million (1.59 × 1020) possible daily settings.

It is often remarked that wits win you a war, rather than numbers. Time and again it has been proven throughout history. There have been many such examples when, despite being on the defense for a long time, a sudden breakthrough with the help of sheer intelligence helps to turn the tables. This is precisely what happened during World War II when Allied forces cracked the Enigma code used by Germans in their radio communication. This not only helped lead to an Allied victory, but also proved how the pure intelligence of a small group of people can save millions of lives.

So what was this Enigma code, and what made it so powerful that breaking it caused the collapse of the German forces?


Recommended Video for you:



The Enigma Machine

enigma machine
The Enigma Machine (Credit: Everett Historical/Shutterstock)

The Enigma Machine was a rotor cipher machine invented by the German electrical engineer Arthur Scherbius. He patented the design in 1918 and his company began marketing it commercially as the "Enigma" from 1923, with the intended customers being banks, railways and diplomatic services that needed to transmit and receive classified messages. The German military spotted its potential and began adopting militarised versions in the late 1920s, with Enigma I entering service with the Reichswehr in 1930. By the time the Second World War broke out, the German armed forces relied on Enigma for almost all radio communications.

What Did The Enigma Machine Do?

Essentially, the Enigma Machine did the same work as any other cipher machine; it facilitated the encryption of classified communication. In other words, it coded and decoded messages that were then transmitted over thousands of miles. The machine was originally meant to transmit confidential business-related information, but by the late 1930s its potential as a wartime transmission device had been fully realised.

How Did The Enigma Machine Work?

enigma machine working
Image Source: enigma.louisedade.co.uk

As mentioned earlier, the Enigma Machine is an electromechanical device, which works through mechanical parts as an electric current passes through it.

The machine consists of four main components: keyboard, plugboard, lampboard and rotors. When you press a key on the keyboard (L, for example), an electric signal is generated, which subsequently moves through all of these components to encrypt an alphabet.

The first stopping point of the electric signal (generated from the ‘L’) is the plugboard. Some of the letters on the plugboard might be connected to another letter (let’s say M). Now, the signal is diverted through ‘M’. The next stop is the entry wheel (in German, the Eintrittswalze or ETW). On military Enigmas this wheel is wired straight through (A to A, B to B, and so on), so it doesn’t scramble the signal; it just bridges the plugboard contacts to the moving rotors. The output of the entry wheel becomes the input to the moving rotors. This is where most of the scrambling takes place.

The Puzzling Rotors (Scramblers)

enigma rotors

On a typical wartime Enigma I or M3, three rotors are loaded into the machine at any one time, selected from a set of three to five (the Kriegsmarine's M4, introduced in 1942 for U-boat traffic, used four rotors). The rightmost one is the fast rotor, the middle is the middle rotor, and the leftmost is the slow rotor. Each rotor has a gauge that displays numbers from 1 to 26 (or letters A to Z). The electric signal first passes through the fast rotor, then through the middle rotor, and finally comes out through the last (the slowest rotor). Therefore, when the letter ‘L’ is pressed, the fast rotor rotates one notch, changing the number in the gauge next to it. After one revolution of the fast rotor is complete, it triggers one notch rotation of the middle rotor.

A good analogy for the rotor stepping is a clock, except that every "hand" runs in base 26 instead of base 60. The fast rotor is the second hand, the middle is the minute hand, and the slow rotor is the hour hand. When 26 steps of the fast rotor are complete, the middle rotor advances one notch; when 26 steps of the middle rotor are complete, the slow rotor advances one notch. (There's also a famous quirk known as the double-stepping anomaly: in some keypresses the middle rotor steps twice in a row, which slightly shortens the overall cipher period.)

Enigma_Machine working
Image Source: Independent.co.uk

We’re Not Done Yet!

After the signal comes out as an output from the slow rotor (left rotor), it goes through the reflector. It takes a letter as an input and reflects a different letter as an output. This output traces the same journey backwards through the machine, until it ends in the lampboard, where it lights up a light bulb under one of the 26 letters. Therefore, after going through the entire circuit, if the letter ‘L’ is encrypted as ‘A’, then the light beneath the ‘A’ is lit. (One important consequence of the reflector design: the output letter is always different from the input. The letter ‘L’ can light up any lamp except the L lamp. This little quirk is the central flaw that Alan Turing's codebreakers later exploited.)


Why Was The Enigma Code Called ‘Uncrackable’?

After reading through how the Enigma Machine worked, you can probably guess how difficult it was to crack the codes that came out of it. If you couldn’t gauge its complexity, then let me help you out.

For a single encoded message, there are a total of 158,962,555,217,826,360,000 possible settings (in other words, it’s almost 159 million million million settings) of the Enigma Machine, only one of which is correct! It also means that you have to work through these many settings to find the one correct setting. I think locating a needle in a haystack would be a cakewalk compared with this.

calculator meme

For a normal human being working without the aid of machines, it would take hundreds of years to go through all these possible settings, and there would still be no guarantee of success. Obviously, you could not possibly take that much time to decode a message in the theater of war, given the fact that the Nazi Army changed the settings of the machine as the clock struck 12 each day at midnight. All you had to work with was a meager 24 hours to go through trillions of millions of possible settings to decode a single message!

Did They Ever Crack The Enigma Code?

Indeed they did!

The first to crack military Enigma were not the British, but a small team at the Polish Cipher Bureau: mathematicians Marian Rejewski, Jerzy Różycki and Henryk Zygalski. Rejewski broke the early military Enigma in December 1932 and the Poles built reconstructed Enigmas and an electromechanical device called the bomba kryptologiczna to attack the daily keys. Five weeks before war broke out, in July 1939 at Pyry near Warsaw, they handed over their methods and a working Enigma to British and French intelligence. At Bletchley Park, a coterie of mathematicians, linguists and engineers led by Alan Turing then built on the Polish work, designed the famous British bombe, and turned routine Enigma decrypts into Ultra intelligence that fed the Allied war effort.

What was the flaw in the code? Can you figure it out?

You may try if you want, but if you can’t find the flaw, don’t worry; we’ve got you covered. Here’s the second part of this article: How Did Alan Turing and His Team Crack The Enigma Code? In this article, we discuss how they spotted that critical flaw in the Enigma Code that caused the fall of the Nazi Army and brought the war to a swifter-than-imagined end.

References (click to expand)
  1. Enigma cipher machines. Crypto Museum
  2. Cracking the Enigma - math.stanford.edu
  3. Enigma and a way to its decryption. cs.miami.edu
  4. IEEE Milestone: First Breaking of Enigma Code by the Polish Cipher Bureau, 1932-1939
  5. Marian Rejewski. Wikipedia
  6. Bletchley Park: Our Story. Bletchley Park Trust