Project 6, 2015 Research Experience for Teachers Project 4, 2016
Enigma

Secret Key, Public Key, Hash Algorithms, Protocols, Authentication, Integrity, Confidentiality, Availability

 

Background:
    This is the famous cipher of World War II. Intercepts using this cipher were decrypted using keys found by machines called "Bombes" which were manufactured in Dayton, Ohio. Keys were found from known plaintext - in this case supplied by encrypted daily broadcasts that always began with the same text. For detailed information about the cipher see this link for a brief description and also this link for everything you always wanted to know about Enigma.

Briefly, each plaintext character was permuted to a ciphertext character in several stages. First, the character was permuted by the plugboard settings, represented by the red and black rows in the applet. Thus, an 'A' plaintext character would permute to the letter 'J' (the red row character opposite the black row 'A' character). Next, that character was permuted three times by a series a rotors. Then the permuted character was permuted by a reflector. Then the permuted character was sent back through the rotors in reverse order and finally to the plugboard. Thus, a ciphertext character was the result of at least nine permutations starting with the corresponding plaintext character. Permutations were changed on the fly by stepping the rotors, much the way the digits of an odometer are stepped.

     

 

On the left is a picture of the Kriegsmarine version of the Enigma machine. Note four rotors and no space bar. The keyboard shown in the applet uses the more familiar Latin key layout (QWERTY) instead of the central Europe Enigma layout (QWERTZ).

 

 

The Enigma machine on the right is a three rotor version that was used by the German army. This one is on exhibit at the National Cryptologic museum and sometimes finds its way to other sites for demonstrations.

     

 

     

 
On the left is a picture of a US Navy Bombe in operation during WWII. On the right is a picture of the last remaining US Navy Bombe which is on exhibit at the National Cryptologic Museum, just outside of Fort Meade, Maryland.

     

Instructions:
    Plugboard and Rotor settings are made initially, usually according to a code book. See this link for an example and this link for detailed procedures involving different branches of the military. Instructions called for selecting rotors and aligning them on a shaft in a particular order. In this applet, four have been selected and ordered and that selection and ordering are fixed.

The red and black rows must represent a valid plugboard permutation. This is signified if all circles between the red and black rows are green. If a circle is yellow, the character labeling that circle is not accounted for in the plugboard permutation. If a circle is red, the character labeling that circle is accounted for more than once - either case invalidates the permutation. Feel free to create different plugboard permutations. Black lines connecting to circles are merely a visual aid for doing so. Similary, initial rotor settings can be chosen using JComboBoxes on the line labeled "Init:" followed by clicking the "Set Rotors" button.

There are three ways to encrypt a message:

 
  1. Click in the textfield that is labeled "msg:". Type a message using your computer's keyboard. The ciphertext appears in the field labeled "enc:". Backspace using the normal backspace key.
  2. Click on letters appearing in the applet's keyboard. To backspace click on the "msg:" field and use the computer's backspace key.
  3. Paste a line of text into the textfield that is labeled "msg:" then click on the "msg:" button. Any ciphertext that had existed in the "enc:" field is erased, the rotors are returned to their initial state, and the encrypted text is placed in the "enc:" textfield.
To decrypt, just type the ciphertext into the "msg:" textfield.

Frequencies of occurence of ciphertext characters are recorded during encryption. To see the results click the "Stats" button. To erase the numbers click the "Reset" button. To hide the stats window click the "Hide" button (statistics will not be reset by this action).

The Enigma machines did not have a space bar - words were just jammed together. The applet above uses a space bar for modern convenience but decryption is always to the letter 'J' instead of a ' '.

Try this:
    Type in a long message and count the number of occurrences of letters in the ciphertext. Use the "Stats" button to bring up the counts (use the "Hide" button to make the counts frame invisible). Compare with the number of occurrences of letters in the plaintext. Do the same after typing a long string consisting only of a single character.

Hint: click the "Clear" button to start from the beginning without having to backspace. Doing this does not reset the statistics window. To do that, open the stats window and click "Reset".

Try this:
    Add some code that automatically computes statistical correlation of the encrypted characters - this will help with the exercises below.

Try this:
    Change the plugboard settings so that the encrypted characters appear to be as random as possible for long strings. That is, there should be only very slight statistical correlation between the appearance of the letters.

Try this:
    Redesign the rotors so that the characters appear to be as random as possible for long strings of your choice.

Questions:
    The cipher is designed so that no message character encrypts to itself. Does this help or hinder the security of the cipher?

The cipher is designed so that the ciphertext may be decrypted in exactly the same way the message plaintext was encrypted with the same initial rotor settings. Does this help or hinder the security of the cipher?