  The Enigma Cipher

The Enigma Cipher

Perhaps the most famous cipher of recent years is that used with the Enigma Machine. It was developed by Arthur Scherbius in 1918, but gained widespread notoriety when it was used by German Intelligence during World War II, and subsequently cracked by the team at Bletchley Park.

What is the Enigma Machine?

The Enigma machine is essentially a complicated substitution cipher machine. It consists of a plug board, a light board, a set of rotors and a reflector.

The machine came with a number of rotors, each of which rotor contained a random substitution alphabet. The user would select between 3 and 5 rotors to use at any one time, depending on the size of the machine. The plug board was another variable for the machine. Certain letters would be connected reciprocally to each other.

The Encryption Process Each month, the German code sender (??) would receive a code book outlining the key to be used for each day. A day key might look like this:

 Plug board: (A,I) (J,F) (E,M) (Z,X) (W,O) (S,B) Rotors: 2,3,1 Rotor key setting: KWO

The machine itself looked like an old fashioned typewriter. When the user pressed the letter to be encoded, it would first pass through the plug board, then through the 3 rotors, the reflector, and back through the rotors in reverse. The encrypted letter would then be lit up on the display. Firstly the operator would set up the plug board as indicated, then would arrange the rotors and finally set the rotors to the day key.

The plug board randomly paired 12 letters to each other. So, if H was mapped to P, P would be mapped to H. The remaining rotors map each letter to another. The encrypted letter reaches the reflector, which unlike the rotors does not rotate, so the mappings remain the same. It then passes back through the reversed rotors.

All in all, the letter passes through a minimum of 7 re-mappings (if the letter is not connected to another on the plug board), and a maximum of 9 re-mappings (if the letter is connected to another on the plug board). Before the next letter would be encoded, the right hand rotor would rotate. The middle rotor would rotate once the right hand rotor had done a complete revolution, and likewise the left hand rotor would rotate once the middle rotor hand undertaken a complete revolution.

The Day Key

They decided to use different keys for each message by setting their machine to the key of the day, e.g. COU, and sending the new key, e.g. NTO encrypted twice, resulting in ZJMELF. The receiver could then decrypt the message using the key of the day and would know to set his or her machine to the new key NTO for the new message.

How Does it Work?

As they were sending hundreds of messages every day, the Germans realised that using a single key every day could decrease the security of the system as it would give the enemy more information to work with in a single key.

The machine consists of a series of 3 rotors, each of which substitutes the original plaintext letter for another. Let us call them rotor 1, rotor 2, and rotor 3. Each rotor is set to encode a specific cipher.

Lets illustrate this by encoding a single letter, the letter H.
Rotor 1 will encode the plaintext as follows:

 INPUT A B C D E F G H I J K L M N O P Q R S T U V W X Y Z Rotor I E K M F L G D Q V Z N T O W Y H X U S P A I B R C J

H → Q

Rotor 2 then takes our new letter Q and encodes this:

 INPUT A B C D E F G H I J K L M N O P Q R S T U V W X Y Z Rotor II A J D K S I R U X B L H W T M C Q G Z N P Y F V O E

Q → Q

The Q is then passed through Rotor 3:

 INPUT A B C D E F G H I J K L M N O P Q R S T U V W X Y Z Rotor III B D F H J L C P R T X V Z N Y E I W G A K M U S Q O

Q → I

At this stage, the encrypted letter reaches the reflector. This was also set to a predetermined encryption. This is the Reflector C:

 INPUT A B C D E F G H I J K L M N O P Q R S T U V W X Y Z Reflector F V P J I A O Y E D R Z X W G C T K U Q S B N M H L

I → E

As you can see, there are only 13 permutations in the reflector, because the letters are arragned in pairs. So,
Now the encrypted letter passes back through the rotors, this time set in the inverse position. So, rotor 3 now looks like this

 INPUT A B C D E F G H I J K L M N O P Q R S T U V W X Y Z Rotor III T A G B P C S D Q E U F V N Z H Y I X J W L R K O M

E → P

Rotor 2 has also been reversed and appears like this:

 INPUT A B C D E F G H I J K L M N O P Q R S T U V W X Y Z Rotor II A J P C Z W R L F B D K O T Y U Q G E N H X M I V S

P → U

Finally our encoded letter passes through the inverse rotor 3:

 INPUT A B C D E F G H I J K L M N O P Q R S T U V W X Y Z Rotor III T A G B P C S D Q E U F V N Z H Y I X J W L R K O M

U → W

The Maths Behind the Enigma

Even though the Enigma machine had a huge number of possibilities for each letter, it still weaknesses that were exploited by the team at Bletchley Park and eventually were its downfall..

Problems with the Enigma

It also guarantees that it is impossible for a letter to be encoded as itself. This was vital to the team at Bletchley Park who helped decode the Enigma.

Position

Inputed Text:

Encrypted Text:

Decrypted Text: