how did the WWII Enigma Machine work and how did they break it?

935 views

i’ve always wondered about this but all of the articles that try to explain it completely fly over my head, especially since i have no background in coding/cryptography/whatever subject it is. any kind soul willing to simplify it a bit?

In: Technology

3 Answers

Anonymous 0 Comments

*I have left out some details, like the reflector and the Kriegsmarine’s extra wheels, plus a dozen things that I’m sure I’ve forgotten. If you have questions or think I’ve left out something interesting, please ask and I’ll do my best.*

**How to use an Enigma machine**

The Enigma machine looked like a typewriter, but with a bunch of letter lights on the top. Once it was set up (I’ll get to that in a minute) what would happen is you’d press a key on the keyboard, and one of the letters on the top would light up.

So if your message was RESUPPLY AT POSITION BRAVO TOMORROW NOON, you’d type R-E-S-U-P-P-L-Y and the lights on top would go A-X-G-K-D-Y-E-I. Your Morse code guy sends AXGKDYEI to your friend. Your friend goes to their Enigma machine, types in A-X-G-K-D-Y-E-I and on top, the letters that light up are R-E-S-U-P-P-L-Y.

So you put in uncoded messages (what the pros call ‘plain text’) and coded messages (‘cypher text’) comes out – or, if you type in cypher text, plain text comes out.

**How the machine’s guts worked (superficially)**

Inside the guts of the machine, there were three wheels, like the ones in an odometer, which each had 26 contacts on each side. Each wheel connected incoming letters to other different letters, so the ‘C’ on one side might be wired to the ‘L’ on the other side, and so on. So each wheel performed one shuffling on the text. You could put those three wheels in in any order you wanted, so there were six possible shuffling combinations (123, 132, 213, 231, 312 or 321) that they could use on any given day.

When you sat down to start work for the day, you’d have instructions that would say “today, the wheel sequence is 2-3-1”.

In addition to that, there was a plugboard on the front of the machine which had the whole alphabet on it, and they had a bunch of cables they could connect that would each perform an additional letter-swap. Typically they’d use 6 cables, but there was no reason they couldn’t have more or fewer. So your daily instructions would also say “connect plugs A-R, G-S, Z-P, Y-B, J-M and E-D”.

Now, all that is bad enough. But it gets worse. Remember how I likened the wheels to an odometer? They really worked like one. Whenever you typed in a letter, the far right wheel would advance by 1/26 of a turn, which would change the shuffling connections for the next letter. And whenever the third wheel had made a full rotation, like an odometer, it would cause the *middle* wheel to advance one step so you’d continue to get fresh shuffling combinations. And if the middle wheel went all the way around, the left wheel would advance once. This meant that unless you typed an absurdly long message, which they never did, every single letter was produced by a unique shuffling, different from every other one in the message.

AND, the wheels didn’t always start at the same place. You could see a three-letter combination showing on the top of the machine that told you the wheels’ positions, and the last part of your daily instructions would be “set the wheels to EVK”, or whatever.

So, as you can imagine, this was nightmarishly good crypto and nobody could touch it for several long, scary years.

**How the good guys (specifically, Poland) cracked it**

What finally happened was an embittered German named Hans-Thilo Schmidt, who was badly in debt and worked in the German cypher bureau, sold some secrets. He couldn’t actually get an Enigma machine, or the wheels, or even the wiring diagrams for the wheels, but he got some technical data about the machine and…even with that, the French weren’t able to make any progress. It wasn’t enough. The Brits couldn’t either.

But a Polish mathematician named Marian Rejewski (ra-YEV-ski) worked some holy-shit mathematical magic on the tiny bits of info Schmidt had smuggled out, and found a way to deduce the wheel wirings and crack some Enigma messages. Soon after, Germany invaded Poland, and as their country was getting crushed, Polish intelligence agents managed to sneak their findings out to France and then England, where it pulled their code-breaking teams out of pretty much total despair.

**What happened after that**

Germany made some improvements to their procedure during the war, and each time Enigma decrypts would dry up for days or weeks. But the “Poland did it, we can do it again” attitude persisted and the allies were always able to catch back up.

There were some crucial weaknesses in German signaling procedures which helped a lot. What happened in The Imitation Game, where stations kept signing off with HEIL HITLER, didn’t happen as far as I know, but what did happen was fairly similar. Some weather stations would begin each message with their station code, or would include predictable information (nice day? weather messages will probably have ‘clear’ in them somewhere). Also, some messages were double-encrypted and in that case it was standard procedure to start the message with the crypto key…repeated twice. Repetition is one of the best things you can give a code-breaker to help them understand your crypto.

So the Bletchley Park team started out with those tools, with which they were able to occasionally crack a message, but it wasn’t consistent enough or fast enough. Poland had built some rudimentary devices that each handled some of the work of a brute-force attack, and now Alan Turing et al built a mechanical computer that (with its search narrowed by known biases in German signals) was able to brute-force Enigma encryption most of the time. This was an intelligence coup so massive that the allies had to be careful to not overuse it; they were worried Germany might come up with some even-nastier crypto system if they thought Enigma had been compromised.

Anonymous 0 Comments

Not here to answer this since another redditor already has a good post on it, but just FYI, if you ever find yourself in England, there’s a full scale reconstructed Enigma-decoder, the Bombe machine, in Bletchley Park that you can still “operate” and it’s well worth the visit. The original Bombes were dismantled after the war for obvious reasons, but they found the blueprints and about 4 decades later reconstructed it. When we visited, there was hardly anyone else in the Bombe room so we pretty much had the machine to ourselves and just “operating” it brought chills. Absolutely thrilling experience.

Oh and Bletchley in general is fascinating and well put together. Would recommend going first thing in the morning and budgeting a whole day for it, if you’re a history buff.

Anonymous 0 Comments

Numberphile did two fairly didactic videos about [how Enigma works](https://www.youtube.com/watch?v=G2_Q9FoD-oQ) and [how it was solved](https://www.youtube.com/watch?v=V4V2bpZlqx8).