Basic CS General AI Chess AI Go AI

 Source CodeAI Tips and Tricks Books Links

# Artificial Intelligence and Enigma Machines

Artificial intelligence has come a long way in recent years. However, some of the first steps toward its creation occurred during World War II. It was during this historic and devastating conflict that humanity first began to realize just how intelligent machines could potentially become with the invention of the Enigma machine.

## Enigma Machine

Coded messages have long protected valuable information from falling into enemy hands. However, until relatively recently in history, codes were usually somewhat breakable because there were only so many ways to code messages manually. That changed when the Germans created the first Engima machines during World War II. The Enigma machine allowed for billions of ways to code a message. For the Allied forces fighting Germany, these codes initially seemed unbreakable. It wasn't until a British mathematician named Alan Turing discovered a weakness in the code and, with the help of his team, created the Bombe machine that could crack the Enigma-created codes. Historians believe that Turing's work was a turning point in the war.

## Encryption

Enigma machines work by using a form of substitution encryption which is a way of encoding messages. For example, a Caesar cipher is a code where each letter in the alphabet is shifted to a certain number of spaces and replaced by a letter corresponding to the new number. For example, if the code moves each letter over three spaces then A becomes D, and Z becomes C. An Enigma machine uses these simple codes but makes it more complicated by changing the encoding for each button push. So even if the user hit the letter Z twice, instead of ZZ the message would be something like CW.

## How an Enigma Machine Works

There are several different parts to an Enigma machine. The machine generally includes rotors, internal circuitry, a keyboard, and a lamp board, with more complicated versions used by the military and intelligence agencies. Most Enigma machines come with three rotors, each having a different encoding scheme. Rotors move into new configurations whenever a key is pressed, allowing each letter to be encoded separately. Operators receive codebooks daily that explain the codes in use for that day.

## Enigma Encryption

The configuration of each Enigma machine is essential for encrypting and decrypting messages. Once a recipient receives a message, they can only decode it by setting their Enigma machines to the same exact settings used by the one used to encrypt the message. Since three rotors, at least, are used at a time, the Enigma machine has thousands of possible configurations. Military-grade Enigma machines have even more configuration possibilities because they have more moving parts.

## Cracking the Enigma Code

A notable flaw with Enigma coding is that it can't encode a letter as itself. Upon discovering this flaw, experts broke the German code in WWII. The Germans accidentally made it even easier by including a weather report at the beginning of every coded message. Once the codebreakers learned that, they could work backward to figure out the weather report and then apply that knowledge to break the code of the message. The Germans also signed most encoded messages with the closing phrase "Heil Hitler," which made it even easier for codebreakers.

Alan Turing and his team used this information to create the Bombe machine, a device designed to decipher Enigma-coded messages. The Bombe machine essentially worked by combining thirty-six different Engima machines into one. The combined power allowed it to improve the chances it could successfully decode each message and do it faster. The Bombe machine starts the process by guessing the initial rotor section. For example, it would assume that D replaced W. However, if the machine detected contradictory information to that initial assumption like that D replaced H and not W, it would reevaluate its previous guesses. The Bombe machine could typically work through all logical guesses in less than thirty minutes. As it ran through each guess, it would narrow down by the process of elimination, and that's how it would eventually break the code and produce the correct interruption of the original message. Turing's work on the Bombe machine laid much of the groundwork for intelligent data processing and AI.