Enigma

"Scherbius's invention would become the most fearsome system of encryption in history." - Simon Singh.

Introduction

I had the opportunity to play around with an Enigma Machine at the National Cryptologic Museum in Maryland. Although, arguably the most famous cipher machine in the history of cryptography, the Enigma machine is a clunky and slowly operative mechanical device (comparing it with today's computers). Sure enough, a letter lights up and the right dial moves one position after pressing a key.

Cipher Disk

Perhaps Enigma's precursor was the very first known mechanized cipher, the cipher disk, invented by Leon Alberti, an Italian architect in the 1400's. The cipher disk actually contains 2 disks one smaller than the other. They both contain all the letters of the alphabet in a circular fashion, but one disk would represent the ciphered letters and the other would represent the plaintext letters. The smaller disk sits on top of the larger disk such that the smaller disk on top could rotate freely. For encryption, the letters of the small disk are relatively aligned with letters of the larger disk via a simple Caesar shift, which provides a simple monoalphabetic substitution cipher. To get the polyalphabetic substitution cipher effect, simply rotate the smaller disk to the next shift settings for each letter requiring encryption. For an example visit: http://www.bletchleypark.net/cryptology/cipherdisk.html.

Components


Enigma cipher machine.
The very first Enigma machine was built by Arthur Scherbius and Richard Ritter, 2 German inventors, in 1918. It was simply an electrical version of the cipher disk. Let's first talk about the Enigma's composition before discussing its dynamics. The Enigma was essentially made up of electrical circuits, 3 - 5 rotors, a key board, a lamp board, stepping levers, ratchets, a reflector and a plug board all encased. Each rotor was internally wired to allow electric signals to pass through it and had 26 input pins and 26 output pins. An input pin was uniquely connected to an output pin to provide a 1 to 1 mapping of one set of letters to another set of letters. So with 3 contiguous rotors an output pin of one rotor was connected to an input pin of the next. Furthermore, each rotor had a moveable notch that allowed the subsequent rotor to rotate. The plug board required 6 pairs of letters to be mapped together before and after all of the rotors were put to use during each key stroke entry. Of course the key board showed the letters the operator could press and the lamp board lit each final mapped letter from the pressed key on the key board.

Encryption

The Germans received a new book of codes each month. This codebook would contain a daily key list that described the placements of the rotor notches and plugboard settings for the operator to set each day. Subsequently this key was also used to decrypt the incoming enciphered message on the receiver's end. A day's code would be something like the following:

Plugboard Setting: (N,K) (P,T) (B,E) (J,V) (Q, C) (R,O)
Rotor Setting: 3-1-2
Rotor Key Setting: FKT

In order to encrypt a plain text message, the operator would enter 1 plain text letter by pressing a letter on the key board. A current from that key first flows to the plug board. Keep in mind that only 6 pairs of letters were mapped here therefore leaving an additional 14 letters unpaired. If the current flows through one that wasn't paired then that letter simply was used. Next the current flows to the first wheel on the right and that wheel mapped the input letter to an output letter on the second wheel i.e. to the middle rotor out of the 3. In turn that rotor did the same to the third rotor. After the third rotor the current reached a reflector, which acts like a rotor but is stationary and doesn't rotate, and always maps the same letters. The current was then reversed back to the third rotor and hence back through the second rotor, the first rotor and the plug board eventually making its way to the lamp board lighting up a letter that never was the same as the letter originally keyed. Each letter entered via the key board would therefore be re-mapped a total of 9 times. Additionally, when each key was pressed on the key board the right rotor moved or rotated one position. This enabled each rotor to act as a unique polyalphabetic substitution cipher. After 26 rotations of the first wheel the second wheel rotated one position and then after that wheel rotated 26 times the third wheel rotated once. This ensured that the re-mapping path was not the same for each letter entered.

Message Key

The Germans realized that by using a single key each day to encrypt 1000's of messages would decrease its security because a cryptanalyst has a little better chance of cracking messages with a lot of ciphertexts encrypted with a constant key. So, a sender who would want to use another key would initially set his machine to the key of the day say FKT. The sender would then pick a new rotor key setting say HNT and encrypt it twice, as a double check for the receiver, using the key of the day, resulting in say a ciphertext of YJKRTL and send that to the receiver. The receiver then would decrypt it using the key of the day, FKT and see the plaintext HNTHNT, thus realizing that he should set his rotor key setting to HNT because the sender will set his rotor key setting likewise. Now, security was strengthened because essentially, each individual message can be encrypted with a unique key. However, it is noted that by May of 1940, the Germans did change their key protocol by not repeating the key twice, which did throw off the scent at BP for a few months.

This figure shows a sample rotor configuration before and after a key stroke. Key stroke letters DGOU are only shown as a representation. (Ideally the rest of the alphabet would be mapped in the same fashion but would clutter the diagram.) Notice through the rotor path going from left to right, DGOU maps to JUGZ before and during the key stroke. After the key is depressed the new mapping for DGOU is LWDX. Also, notice how the right rotor's configuration are different for each setting.

Decryption

When the recipient received an encrypted message the decryption process was essentially done in reverse. However, it was very important that the receiver's machine was set up exactly the same way the sender's machine was before that same message was sent as per the key of the day or else the intended message would not be the same. The recipient had to ensure that the correct rotors were used with their initial configuration as well and the plug board also had to be set up the same way. Once this was done, then the recipient had to type in the encrypted message and the intended plain text message would be lit up by the lamp board letter by letter.

Conclusion

The Enigma machine came about during a time when a handful of others around the world were developing similar machines but primarily for business purposes. However, for instance in the United States during the 1920's, it was a time to open up to international business, thus downplaying the need for encryption devices. However, during the 1930's the Nazi party quickly saw the benefits of having such a device and at the same time they wanted to vastly improve on the weak security Germany once had during World War I. The German military thus bought well over 30,000 Enigma machines.