In 1923, the firm of German engineer Arthur Scherbius (1878–1929) began selling a machine that could encrypt messages automatically. Marketed as Enigma, it was soon adopted (and adapted) by the German military, and by the outbreak of World War II, it was used for almost all important German military communications. To understand the mathematics behind Enigma, it helps to have an Enigma machine. Unfortunately, most of the remaining machines are in museums, whose curators don’t take too kindly to handling their exhibits, so we’ll have to make do with a mockup. Online Enigma emulators are available, but to understand the mathematical details, we’ll set up a simple “paper” Enigma to analyze key points. We will do this in two parts, pausing to take part in some specific activities along the way. |
Figure 3. Enigma machine in use in a radio tank during the Battle of France in May 1940. Wikimedia Commons. CC BY-SA 3.0 de.
|
Figure 4. A display of Enigma machines and paraphernalia exhibited at the U.S. National Cryptologic Museum.
Left side of display: Enigma machines from 1923 to 1939. Right side of display: Enigma machines from 1939 to 1945.
Photographs by Robert Malmgren. Creative Commons Attribution-Share Alike 3.0 Unported.
Mechanically, an Enigma machine consisted of a set of encryption drums or rotors. The rotors have contact points on each side, joined by wires. It’s convenient to think of these contact points as representing letters, with the wiring joining two letters of the alphabet. When an operator pressed a letter, an electrical current flowed between the contacts, lighting up the encrypted version of the letter.
For our paper Engima, we’ll consider a six letter alphabet: \(a, b, c, d, e, f\). A “side” view of a rotor might look like the following (the different line styles have no significance, and they are only used to make it easier to distinguish between connections):
Figure 5. Side view of a rotor. All diagrams in
this article were created by the author.
In the diagram in Figure 5, the left-side \(a\) is connected to the right-side \(b\); the left-side \(b\) is connected to to the right-side \(c\); and so on.
Before we can describe this mathematically, we need to make a decision: Since electrical current can flow along a wire in either direction, we must choose a direction, either left-to-right or right-to-left. For example, if current is flowing from left to right, then the (left side) \(a\) is connected to the (right side) \(b\). Consequently, if the operator pressed \(a\), the current would light up \(b\), which would be the encrypted version. We might write this as \(a \rightarrow b\).
We can compile all of these left-to-right encryptions in tabular form as
\[\left(\begin{array}{cccccc} a & b&c &d &e &f \\ \downarrow &\downarrow &\downarrow &\downarrow &\downarrow &\downarrow \\b&c&f &e&d &a \end{array}\right)\]
Mathematically, we've taken the letters in the order \(a, b, c, d, e, f\), and rearranged them as \(b, c, f, e, d, a\). This is an example of what mathematicians call a permutation.
If we omit the down arrows and enclose everything in parentheses, we can represent our encryption in Cauchy two-line notation:
\[\left(\begin{array}{cccccc} a & b&c &d &e &f \\ b&c&f &e&d &a \end{array}\right)\]
Perhaps surprisingly to readers familiar with Stigler’s law of eponymy, Cauchy two-line notation is named after its inventor, Augustin-Louis Cauchy (1789–1857); you can read his original 1815 publication (en Français) here.
What if our current ran from right to left? In that case, we can represent our permutation as \[\left(\begin{array}{cccccc} a & b&c &d &e &f \\ f&a&b &e&d &c \end{array}\right)\]
To explore the basics of rotor design and permutations further, continue to the Activities for Part 1.1 (Rotors).
Return to the overview of Part 1 (Enigma on Paper).
Skip to the overview of Part 1.2 (The Enigma Encryption).
Suggestion: “Things that do the same thing are the same thing.”
We can view a permutation as a function, so the permutation on the left maps a → b, d → e, and so on;
what does the permutation on the right do?
Return to the overview of Part 1.1 (Rotors).
Continue to the overview of Part 1.2 (The Enigma Encryption).
To encrypt a message, an Enigma operator typed it into a keyboard. When a key was pressed, an electrical signal would pass through a plugboard \(S\); through a sequence of rotors \(R_{1}\), \(R_{2}\), \(R_{3}\); then through a reflector \(Q\) that would send the signal back through the rotors in the reverse order, and then through the plugboard, lighting up the encrypted version of the letter. We can represent this process as encrypting the original plaintext letter \(p\) as the encrypted ciphertext letter \(c\).
Figure 6. Diagram of Enigma encryption process,
beginning with the plaintext letter \(p\) and ending with the ciphertext letter \(c\).
To create the paper Enigma, you’ll need to cut out a set of encryption rotors; a template appears here. For convenience and tractability, we’ll omit the plugboard and use just a single rotor and the reflector; we’ll also reduce our alphabet to six letters \(a\), \(b\), \(c\), \(d\), \(e\), \(f\). These omissions do not substantially alter the process used by the Poles to break Enigma.
Our paper Enigma will require two types of rotors: a “keyboard” rotor and a “reflector” rotor. To prepare a keyboard rotor, draw one-way arrows from one vertex to another. Each vertex should have a unique “outgoing” arrow and a unique “incoming” arrow. Figure 7 below shows some “forbidden” setups and one allowable one. (Note that while you can do a “return” path so that two vertices are connected to each other, it’s discouraged because it’s less interesting.)
Figure 7. Diagrams of various allowable and forbidden “keyboard” rotors.
The reflector rotor is constructed in almost the same way, but this time our arrows are bidirectional and simply join vertices. Again, every vertex must have one and only one connection. The primary problem faced and solved by the Poles was determining the internal wirings of the reflector and the rotor. For our examples, we’ll use the reflector and keyboard rotor in Figure 8.
Figure 8. Diagrams of sample reflector and keyboard rotors.
To make a paper Enigma, set the reflector rotor into the “Reflector” circle and the keyboard rotor into the “Keyboard” circle in the paper Enigma available here. It will help to pin the rotors down through the hole in the center. As a check to make sure you are ready to follow along with the examples below, your initial setup should look something like that shown in Figure 9 below (the dashed line has no significance and is only there to make the process easier to follow).
Figure 9. Initial setup of reflector and keyboard rotors.
In general, a letter will be encrypted by sending it through the keyboard rotor; then the reflector; and then “backwards” through the keyboard rotor.
For example, if we pressed \(a\), then:
Thus this setup would encrypt \(a\) as \(d\).
Used this way, Enigma would have been a simple substitution cipher and would have been trivial to break. So the actual Enigma machine incorporated one more feature that vastly compounded the difficulty: every time a key was pressed, the keyboard rotor would advance one place.[2]
As an example, let’s encrypt the word \(cab\). When we press the first letter \(c\), the keyboard rotor will advance one place, which we’ll take to be a counterclockwise rotation. Thus the encryption of the first letter would use the setup shown in Figure 10.
Figure 10. Setup for encryption of first letter.
To encrypt the first letter (\(c\)), we’ll send it through the keyboard rotor, the reflector, then “backwards” through the keyboard rotor:
So \(c\) is encrypted as \(d\).
Now for the second letter (\(a\)). Again, pressing the key advances the keyboard rotor one place, so the encryption will be based on the configuration in Figure 11.
Figure 11. Setup for encryption of second letter.
To encrypt the second letter of our message (\(a\)):
So \(a\) is encrypted as \(b\).
Finally, for the third letter, our rotor shifts one place, as shown in Figure 12.
Figure 12. Setup for encryption of third letter.
Our encrpytion of \(b\) will be:
So \(b\) would be encrypted as \(f\). Thus the word \(cab\) would be encrypted as \(dbf\).
To explore the basics of rotor design and permutations further, continue to the Activities for Part 1.2 (Encryption).
Return to the overview of Part 1 (Enigma on Paper).
Skip to the overview of Part 2 (The Algebra of Enigma).
[2] The second and third rotors on the actual Enigma would also advance one place for every full turn of the preceding rotor.
Suggestion: The encryption activities are easier if they are done as group activities, with one person calling out the keyboard encryptions and the other the reflector encryptions.
For activities 1–4 in this section, we continue with the example from the previous page, for which the "Initial Setup" was as follows: