How Did Nazi Germany's Enigma Machine Really Work?

It's tempting to think of war chiefly in terms of big guns vs. bigger guns, ground-troop tactics, the teeth-clenching grit of generals and grunts, and so on. But the truth is, there's a whole stratum of staff and strategists sandwiched between ground-level boots in the mud and high-level political talking points. We're talking analysts, engineers, software developers, systems modelers, and yes, loads of mathematicians, as West Point Military Academy describes. Whether or not one side wins, or how a conflict progresses, depends on all of these factors working together.

World War II perfectly illustrates how, in war, intellects clash alongside bodies and machines. On one hand, Nazi Germany went for a "bigger equals better" approach to weapons development. "Wonder Weapons," like the Great Gustav rail gun or the Karl-Gerät siege mortar machine, aka "Thor," were ludicrously huge, over-engineered resource gobblers intended to invoke fear and awe in enemies and allies alike (via All That's Interesting). 

On the other hand, the Third Reich also developed astoundingly clever technology like the "Enigma," a cryptographic machine used to send indecipherable, coded messages between German forces. The Enigma baffled Allied powers for awhile, and proved a stumbling block for military strategists. It wasn't until the Allies pooled their efforts, and Polish code-breakers passed their baton of research along to mathematical geniuses like England's Alan Turing, that the Enigma was finally cracked, as the BBC outlines.

Built on the Caesar Cipher

On the outside, the Enigma Machine looks something like an old-school typewriter combined with one of those old-timey cord-and-plug telephone operator boards. It was small enough to be toted around in a box during a war effort, plugged into an electricity source on the spot, and operated as necessary. As Smithsonian Magazine explains, "Enigma" refers not to one, specific, unchanging machine, but a suite of devices developed in the 1920s that was adapted for military service through the '20s and '30s. Over the course of the war, the machine evolved to become more and more complex, and provide a greater variety of combinations of codes.

As Brilliant explains, the Enigma ran a hyper-complex version of what's called a "Caesar Cipher." Caesar Ciphers, as explained on Science Direct, are in fact named after Rome's most famous dictator, Julius Caesar. By all accounts, Caesar employed his "monoalphabetic, rotational substitution cipher" to communicate in secret. 

At its heart, the Caesar Cipher is actually pretty simple, and take advantage of Roman alphabetical writing (this alphabet we're using right here). Simply line up two rows of letters, A-Z. Take the bottom row and shift it over a certain number of places: two, three, seven, whatever. Then write your sentence, but substitute each letter in the original, top row with the shifted letters in the bottom row. So with a shift of 5, for instance, "math is fun" becomes "rfym nx kzs." Perfect for kids sending clandestine messages during class.

Rotors created random letter substitutions

If the Enigma stopped at a Caesar Cipher, it would've been cracked in less than an hour. The Enigma compounded the complexity, variability, and randomness of its letter-substitution cipher to an extreme length. It's all quite difficult to explain using only words, so bear with us and use your imagination.

The key component of the Enigma machine was rotors, as Brilliant explains. In this case, the machine's rotors acted like dials on a combination lock, the kind you might use for luggage that makes a combination like "5-7-2," all displayed at one time. In the case of the Enigma, it used the Roman alphabet's 26 letters, not Arabic numbers (1-9). The letters were written around the outside of a rotor near its notches, and were manually set using an operator's thumb or finger at the beginning of a transmission. Usually there were three rotors, although sometimes there were more. More rotors meant a more complex mechanism, because all the rotors were connected by the same shaft, like tires connected to a car axle. They operated in sequence from one to the next, and depended on the ones that came before. 

Essentially, the Enigma made each and every letter substitution random, from one letter to the next, each and every time. Every time a message was sent, the cipher was different. Not only was the cipher not static, therefore, it produced an absurd number of combinations. Its most advanced version yielded (get ready) 158,962,555,217,826,360,000 possible combinations.

Plugboards for deeper encryption

The Nazis didn't stop at a ream of rotors randomizing rotating letters. Another layer of impenetrability got added to latter Enigma machines to make messages even more impossible to decipher: the plugboard. Plugboards complicated an entire cipher by shifting each randomized letter by an additional step.

Plugboards were laid out like qwerty keyboards on the back of an Enigma machine. Each letter had an electrical jack similar to the quarter-inch jacks used by musicians to plug in their instruments. As Brilliant explains, operators used male-to-male cords to connect one letter to another. Because there were 26 letters, this meant 13 plugs, each end jacked into a different letter. This also meant that no letter could be plugged into itself — no "M" to "M," for instance. This would prove a key factor in figuring out how the Enigma machine worked. Another potential limitation? The plugboard just swapped letters, like "G" for "Y." Knowing one meant you could discern the other.

Each and every randomly generated letter assignment got re-routed according to the plugboard. The already scrambled "sdhk jof flsjk," for example, would become another string of letters entirely according the transposition dictated by the plugboard. Operators could even re-assign the plugs mid-sentence, mid-word, whenever.  

Folks read the Enigma machine's output using its "lamp board," a qwerty-like readout where each letter lit up according to its final, encoded form. When one letter was typed, its converted, encrypted equivalent lit up on the lamp board.

Decrypting the code with pre-modern computers

Just imagine being the person intercepting German messages and staring at your print-out, wondering what the heck the pattern is. It took extreme genius to not only decrypt the Enigma machine's messages, but figure out how the whole thing worked. 

As the BBC explains, initial success in deciphering the Enigma came from Poland, who had the foresight to use mathematicians rather than linguists, like in England. Key breakthroughs began with "cribs," assumed parts of messages that could be used to crack the entire code. We already talked about two cribs: Enigmas not being able to substitute a letter for itself, like "M" for "M," and plugboards only swapping two letters for each other. Another big crib, as Brilliant explains? Nazis always, foolishly so, ended their messages with "Heil Hitler." This gave cryptologists a whole bunch of freebie letters every time. 

British mathematicians Alan Turing and Gordon Welchman ran with the research provided by Polish mathematicians and built what's called a Bombe machine. A Bombe machine was essentially a pre-modern computer, a giant calculator that daisy-chained 36 Enigma machines simultaneously. Bombe machines ran simulations that generated possible outputs to try and match a message, and thereby reveal its original, undecrypted form. It was impossible to know a cipher before it was coded and transmitted, but eventually, Bombe machines could decipher a Nazi cipher in under 20 minutes. This gave the Allies a tremendous upper hand, and turned the tide of World War II.

A vital war effort turned museum piece

All in all, as Smithsonian Magazine says, it's estimated that the development of the Bombe machine shaved at least two years off the war effort. However, because it's impossible to predict how things might have played out if World War II didn't end how and when it did, the final repercussions of figuring out the Enigma remain incalculable.

Efforts to crack the Enigma weren't revealed to the public until the 1970s, as the McGill School of Computer Science explains. All such efforts, starting with the first Enigma machine copy built in 1933 by the Polish Cipher Bureau, were given the codename "ULTRA." In addition to the aforementioned cribs, such efforts were aided by German overconfidence. Because they believed that the Enigma couldn't be cracked, they used it for absolutely every single communication.  

About 20,000 Enigma machines were produced before and during World War II. Only about 50 remain intact nowadays, to our knowledge, in the hands of museums and various private collectors. They've sold for a lot of money, with a more common, three-rotor Enigma 1 going for $51,620 in 2017 to an anonymous online bidder. In 2015, a less common, four-rotor Enigma M4 sold for $365,000, and in 2017, another M4 sold for $547,500.

The 2014 film "The Imitation Game" dramatized Alan Turing's contributions to deciphering the Enigma machine. He led his "Hut 8" team from a top-secret code-breaking site at Bletchley, an estate located about one-and-a-half hours northwest from London.