Click for homepage
← Enigma
Family tree →
  
How does an Enigma machine work?
On this page we will try to explain how the Enigma works. We do this by first examining the circuit diagram and following the electric current from the keyboard, through the wheels, to the lamp panel. Next we explain the movement of the wheels, the configuration of the plug board and the total possible number of settings. Finally, the differences between the various Enigma models and some weaknesses of the system are discussed. Have fun!


Circuit diagram
When studying the working principle of the Enigma, we have to consider that there are in fact many different variants of this machine. Some of the differences make it impossible to decrypt a message that was encoded on another model. That does however not affect the working principle as explained here. For this we study the circuit diagram of a standard 3-wheel Wehrmacht Enigma.

Simplified circuit diagram of a 3-wheel Service Enigma

Letters are 'scrambled' by a set of rotatable wheels each with 26 contacts on either side. Each contact on one side is connected (wired) to a contact on the other side in some random fashion. Some models, like the standard Service Enigma and the M3 have 3 such rotating wheels, but the M4 model, used later in the war exclusively for the German U-Boats, has 4 wheels. Each time a key is pressed, the right most wheel is rotated by one step, resulting in a different mapping of the internal wires. As a result, each new letter is encoded differently.

Each wheel has one or more notches that may cause the next wheel to be moved by one position too. If a wheel has only one notch, it needs to complete a full revolution before the wheel to the left of it is stepped by one position.

The keyboard consists of 26 keys, marked A-Z. Whenever a key, say Q, is pressed the wheels will be moved into a new position and a contact is closed. As a result a current will flow. The wires from the 26 keys are connected to a static wheel called the Stator or Entrittswalze (ETW). The order in which the keys are connected to the 26 contacts on the ETW varies between the different Enigma models.

Leaving the ETW, the current enters the right most wheel (1) via one of the contacts at its right hand side. The internal wiring of that wheel 'translates' this current to one of the contacts on the left side of the wheel. From there the current is 'handed over' to the next wheel, and so on. Left of the rotating wheels is the Reflector, or Umkehrwalze (UKW). This wheel sends the current back into the rotating wheels, but this time the current flows from left to right, until it reaches the ETW again. From the ETW the current goes to the lamp board where the corresponding letter (E in the example) will be lit. It is inherent to this design, that a letter can never be encoded into itself.

Before starting the ciphering process, the Enigma needs to be setup in a known way at both sides of the communication link. This means the wheel order (Walzenlage) needs to be known as well as the starting position of each wheel (Grundstellung). In order to further complicate things, each wheel has a settable index ring that moves the contacts independant of the wheel's alphabet. This is called the ring setting (Ringstellung).

To make life even more complex, the Wehrmacht machines were all equipped with a plug board, or patch panel (Steckerbrett), that allows pairs of letters to be swapped. Any number of cables from none to 13 may be connected to the Steckerbrett, meaning that between 0 and 13 letter pairs may be swapped. If a letter is not mapped (i.e. no stecker is used for that letter), the letter is known to be Self-Steckered. See below for more information.


Wheel rotation in more detail
Below each key of the keyboard is a two-position switch. The key has to be fully depressed before the switch is activated. The key also controls the wheel movement. Whenever a key is pressed, the rightmost wheel makes a single step before the switch is activated and a lamp is turned on.

Each wheel has 26 positions that we will call A-Z. The index on the wheels is engraved (either as A-Z or 1-26) along the side of the wheel. When a key is pressed, the rightmost wheel is rotated counter clockwise, when viewed from the ETW. If the letter A was visible in the window, the letter B will be visible next time the wheel is moved.

Each wheel has a ring that can be used to rotate the wiring independantly of the index. This can be regarded as creating an offset in the opposite direction. The wheel-turnover notches are fixed to the index ring. Therefore the turnover of the next wheel, will always happen at the same letter in the window, but the wiring might be rotated.
  
Exploded view of an Enigma cipher wheel

Wheel movement is much like the odometer in a car. If the rightmost wheel has made a full turn, it will carry on the next wheel by one step. Most Enigma models are equipped with stepping levers and notches, rather than with cogwheels. Whenever the position of a notch is reached, it engages a pawl. On the next key press, this pawl will carry-on the next wheel. This principle is called Enigma stepping and has the strange side-effect that the middle rotor steps twice (on two successive key presses) if the leftmost wheel also makes a step. This phenomena, known as the double stepping anomaly (see below), has been described in detail by David Hamer in 1997 [1].

Wheelset
The wheels removed from the spindle
The three wheels removed from the spindle
Wheel number 4 showing its 26 spring-loaded contacts
Locating the Ringstellung
Releasing the ring
Setting the start position (Grundstellung)
Removing a plug (Stecker)
A
×
A
1 / 8
Wheelset
A
2 / 8
The wheels removed from the spindle
A
3 / 8
The three wheels removed from the spindle
A
4 / 8
Wheel number 4 showing its 26 spring-loaded contacts
A
5 / 8
Locating the Ringstellung
A
6 / 8
Releasing the ring
A
7 / 8
Setting the start position (Grundstellung)
A
8 / 8
Removing a plug (Stecker)

Double stepping
The table below should illustrate what happens. Wheel I is placed in the rightmost position (also called the 'fast' position). It causes the next wheel to step when it changes from Q to R. Wheel II is in the middle position. It causes a step when changing from E to F. Now observe what happens:

III II I <-- wheel order
A D O
A D P
A D Q
A E R <-- 1st step of middle wheel
B F S <-- 2nd step of middle wheel
B F T
B F U

When the fast wheel changes from Q to R, it causes the middle wheel (II) to step from D to E. One the next step, the rightmost wheel changes from R to S and the middle wheel makes one more step: from E to F. At the same time, the middle wheel causes the left wheel (I) to make a single step. This double stepping anomaly reduces the cryptographic period of the system.

Some Enigma machines, such as the Zählwerksmaschine A28 and the Enigma G, were driven by a gear mechanism with cog-wheels rather than by pawls and rachets. These machines do not suffer from the double stepping anomaly and behave exactly like the odometer of a car. They have the additional advantage that they can be wound back by means of a crank in case of a typo, whereas machines with Enigma Stepping can only be moved forward.


The Steckerbrett
The Wehrmacht variants of the Enigma (Service Enigma, M3 and M4) were equipped with a plug board (Steckerbrett) at the front, that would allow any pair of letters to be swapped. For this purpose 12 patch cables were usually supplied: 10 to be used on the Steckerbrett and 2 spares that were stored inside the top lid of the case. As the Steckerbrett is connected between the keyboard and the ETW, each encoded letter will go through the stecker mappings twice. This does not affect the machine's reciprocity (reversibility) and a letter can still not be encoded into itself.

Cross-section of the Enigma Steckerbrett

Each patch cable as a 2-pin plug at either side. Each plug has a thick and a thin pin, so that it can not be inserted the wrong way around. The cable swaps the wiring between the plugs. In other words: the thick pin of one plug is connected to the thin pin of the other one and vice versa.

The image on the right shows a double-ended plug with a thick and a thin pin. Swapping the letters in pairs means that if A is transposed into Z, the reverse is also true: Z is transposed into A. This is called self-reciprocity. Compared to a single-ended Steckerbrett, this reduces the total number of possible combinations significantly.

The same self-reciprocity was exploited by Gordon Welchman when improving Turing's Bombe, resulting in shorter Bombe-runs when breaking the Enigma's daily keys. It effectively eliminated the Steckerbrett from the equasion.
  
Double-ended plug (Stecker)

With 26 letters, and hence 26 sockets on the Steckerbrett, a maximum of 13 patch cables could be installed. Any number of cables between 0 and 13 was possible and the maximum number of combinations would be reached when the number of patch cables was different each day. In practice however, the German operation procedure generally instructed the use of 10 cables. The total number of combinations for each number of cables is calculated as follows [2]:


The table below shows the number of combinations for each number of cables:

Cables (n) Possible combinations
0 1
1 325
2 44,850
3 3,453,450
4 164,038,875
5 5,019,589,575
6 100,391,791,500
7 1,305,093,290,000
8 10,767,019,640,000
9 53,835,098,190,000
10 150,738,274,900,000 <-- Most common number of cables
11 205,552,193,100,000 <-- Highest number of combinations
12 102,776,096,500,000
13 7,905,853,580,550
Total 532,985,208,200,000

Table above shows that it is theoretically possible to multiply the number of possibilities of a non-Steckered machine (approx. 71 million) with over 500 million million Stecker combinations. However, as the Germans always used exactly 10 cables, the multiplication factor would be 'just' 150 million million, resulting in a total of approx. 180 million million million permutations.

Also note that the mathematical optimum is at 11 cables, not at 10. With more than 11 cables, the number of possibilities decreases again. It would have been far better though not to restrict the number of cables at all and use all possible combinations. Also note that the number of possible combinations with a double-ended plugboard is significantly less than with a single-ended one.

 History of the Steckerbrett

View at the plug board (Steckerbrett)
Close-up of the Steckerbrett
Removing a plug (Stecker)
Placing a plug (Stecker)
Testing a cable
Rightmost test socket
Patch cable
Double-ended plug (Stecker)
B
×
B
1 / 8
View at the plug board (Steckerbrett)
B
2 / 8
Close-up of the Steckerbrett
B
3 / 8
Removing a plug (Stecker)
B
4 / 8
Placing a plug (Stecker)
B
5 / 8
Testing a cable
B
6 / 8
Rightmost test socket
B
7 / 8
Patch cable
B
8 / 8
Double-ended plug (Stecker)

Permutations
The total number of possible settings of the Enigma machine can be calculated in various ways. A detailed description of the mathematics behind the Enigma can be found in The Cryptographic Methematics of Enigma, distributed by the NSA in 1996 [3]. In this publication, it is assumed that the wheel wiring is unknown, which greatly increases the number of possible settings.

According to Kerkhoffs' Principle however, we should assume that a possible attacker has full knowledge of the system, including its wiring. So, in order to make a more realistic estimation of the number of possible settings, we assume that the attacker knows the wiring of the wheels, the entry wheel (ETW) and the reflector (UKW). We therefore only need to consider the possible settings of the wheels and the configuration of the Steckerbrett. Let's first look at the wheels:

English German Calculation Total  
Wheel order Walzenlage 5 x 4 x 3 60  
Ring setting Ringstellung 26 x 26 676 ×
Start position Grundstelling 26 x 26 x 26 17,576 ×
    Total 712,882,560  

Please note that the Ringstellung of the leftmost wheel has no effect as its notch can not move the wheel to its left. Next we need to take the Steckerbrett into account, and we assume that the Germans always used exactly 10 cables on the Steckerbrett. This leads to the multiplication:

                    712,882,560
            150,738,274,900,000 ×
107,458,491,300,000,000,000,000 ≈ 1.07 x 1023 ≈ 276 = 76 bits

Compared to modern computer encryption, this would be the equivalent of 76 bits; which is quite an achievement for its era. If we consider the 4-wheel Naval Enigma (M4), we have to take the following into account. The M4 and an extra wheel to the left of the three standard wheels. This wheel could not be exchanged with the other wheels. Furthermore it did not move during encypherment. The Navy had a set of 8 wheels to chose from. This leads to the following table:

English German Calculation Total  
Wheel order Walzenlage 8 x 7 x 6 336  
Reflector UKW β or γ 2 ×
Extra wheel Zusatzwalze b or c 2 ×
Ring setting Ringstellung 26 x 26 676 ×
Start position Grundstelling 26 x 26 x 26 x 26 456,976 ×
    Total 415,182,802,800  

If we multiply this with the result of the Steckerbrett, we get the following:

                   415,182,802,800
               150,738,274,900,000 ×
62,583,939,462,218,889,720,000,000 ≈ 6.26 x 1025 ≈ 286 = 86 bits

This makes the 4-wheel variant significantly stronger than the 3-wheel machine. In practice, the total number of combinations was less then the number calculated here, as there were several restrictions imposed on the selection of the wheels. For example: the Navy always used at least one of their extra wheels (VI, VII and VIII) and such an extra wheel should never appear in the same position on two successive days.


Differences in Enigma models
When examining the different versions of the Enigma, the following differences can be observed:

  • Steckerbrett
    Some models have a Steckerbrett (plug board, or patch panel) and some don't. Only the military machines, used by the German Army, Air Force and Navy, had such a plug board. The maximum number of patch cables is 13 (as we have 26 letters), but the number of cables supplied with the unit varies. The highest number of permutations is achieved with 11 patch cables. In most cases, 10 cables were used on the plug board, with two spares stowed in the case lid. The Steckerbrett was used exclusively by the German Wehrmacht and did not appear on any other model.  History of the plug board

  • ETW mapping
    The Eintrittswalze (ETW) can be mapped in the order of the alphabet: ABCDEFGH... etc, but also in the order of the keyboard: QWERTZUIO... On the Japanese Enigma T (Tirpitz), the contacts of the ETW are organised in a random order: KZROUQHY...

  • Numbers or letters
    Some wheels have numbers engraved on their circumference (01-26), whilst others have letters (A-Z). Initially all Enigma machines had letters on their wheels. This is definitely the case for all commercial Enigma machines produced prior to WWII. When the German Army adopted the machine for military use, they added a Steckerbrett (see above) and and decided to have numbers on the wheels (01-26). Naval machines however, (M1, M2, M3 and M4), remained to have letters.

  • Number of different of wheels
    Most models have 3 rotatable wheels, but the M4 has 4 wheels. Also some models have a range of wheels (e.g. 8) to choose from. The wheels may be placed in the machine in any particular order.

    On the Naval M4 (a 4 wheel machine), the extra wheel is not moved automatically, but can be set manually to an initial position. Furthermore the extra wheel cannot be exchanged with the other three wheels as it has spring-loaded contacts at both sides. The 4th wheel was supplied as a pair with a thinner version of the UKW. For UKWs B and C, the extra wheels Beta and Gamma where supplied, hence the name Griechenwalze (Greek wheel). They may be used however in any combination. The 4th wheel on an Abwehr Enigma (G-series) is moved by the other wheels, due to the mechanical difference of this model.

  • UKW mapping and setting
    Some models have more than one UKW available. On most models the UKW is fixed, but on some the UKW can be given a start position. Additionally, the G models have a movable UKW, which means that the wheel can be moved by the notches of the wheel next to it.

  • Wheel wiring
    Although the wiring of the wheels I to V was identical for all military Enigma machines during WWII, other versions used a different wiring. This wiring could be different for each customer.

  • Wheel stepping
    Two different wheel stepping mechanisms are known: a simple one – known as Enigma Stepping – in which pawls and levers are used to advance the wheels, and a more advanced one, in which cog wheels are used to drive the wheels. Only machines in the Zählwerk class (A28, G31) fall into this category. All other machines had the simpler (and cheaper) Enigma Stepping, which has a double stepping anomaly (see below).

  • Double stepping anomaly
    As a result of the mechanical principle of the Enigma Stepping mechanism, the middle rotor 'suffers' from a so-called double stepping anomaly, described in detail in a paper by David Hamer in 1997 [1]. Enigma machines of the Zählwerk class, such as the Enigma-G, do not suffer from this anomaly, as their cipher wheels are driven by cog wheels.

  • Number of notches on each wheel
    In the basic design, each wheel has one notch which, after a full revolution of the wheel, causes the next wheel to be advanced by one position. Some versions have two or even more notches on each wheel, causing more frequent changeovers of the next wheel. The three wheels of the Enigma-G have 11, 15 and 17 notches respectively.

  • Manufacturer
    Before and during WWII, the Enigma machines were built by various manufacturers. Although these machines were mathematically compatible, there are a few cosmetic differences. Additionally there are physical differences between the thin wheels from some manufacturers.
Weaknesses
The basic Enigma design has a number of weaknesses that were exploited by the Allied codebreakers of Bletchley Park During WWII:

  • A letter can never be encoded into itself
    One of the key properties of the Enigma design is the fact that a letter can never be encoded into itself. In other words: when the letter A is pressed, every lamp on the lamp panel can be lit, except for the letter A itself. This property is caused by the fact that a reflector (UKW) is used; the return path is always different from the entry path.

  • Regular stepping of the wheels
    In most Enigma machines, the rightmost wheel needs to complete a full revolution before the wheel to its left is advanced by one position. As a result, the 2nd wheel only steps once every 26 characters and the 3rd wheel hardly ever moves. This makes the Enigma more predictable. Some Enigma variants (such as the Enigma T) had multiple turnover notches and the Zählwerksmaschine (Enigma G) even featured a cog wheel mechanism to cause irregular stepping.

  • Double stepping of the middle rotor
    Under certain circumstances, the middle rotor can make two steps on two subsequent key presses. This effectively halves the cipher period. The double stepping feature is described in a paper by David Hamer [1].

  • 4th wheel not moving
    In the Naval Enigma M4, the extra wheel (Zusatswalze) can be set to any of 26 position at the start of a message. During encipherment, however, the wheel never moves. Together with the UKW, this wheel can be regarded as a selection between 26 different UKWs.

  • 2 Notches on the extra Naval wheels
    The three extra Naval wheels (VI, VII and VIII) each have two notches to cause a more frequent wheel turnover. However, as 2 is a relative prime (co-prime) of 26 and because the two notches are positioned opposite each other, the cipher period is effectively halved.

  • Mandatory use of extra Naval wheels
    If the operator could pick any three wheels from the available 8 on any given day, there would have been 336 possible different wheel orders. In practice however, the Navy was instructed to use at least one extra Naval wheel each day (VI, VII or VIII) and that the selected wheel could not be used in the same position on two successive days.

  • Fixed number of cables on the Steckerbrett
    The Steckerbrett has 26 sockets, one for each letter of the alphabet. Cables were used to swap pairs of letters. If a cable was omitted, that letter would not be swapped. In theory, any number of cables between 0 and 13 would thus be possible, with 11 cables producing the highest result. In practice, the procedures commanded the use a fixed number of cables (10 in most cases), which greatly reduces the maximum number of possibilities.

  • Letters always swapped in pairs on the Steckerbrett
    Each patch cable on the Steckerbrett swaps a pair of letters. Compared to a single-ended Steckerbrett, this reduces the number of possible combinations dramatically. Further­more, swapping letters in pairs, makes the Steckerbrett self-reciprocal, as a result of which it can be eleminated from the equasion when determining the order of the cipher wheels for a given day. Although a single-ended plugboard — which does not suffer from these problems — was tried in 1927, it was thought to be too prone to mistakes.  More
Animation
A great animation on how the Enigma works is available below. It was created in December 2021 by Jared Owen, and features Enigma I — the most common Enigma model that was used by the German Army during WWII. For more great animations, visit Jared Owen's YouTube channel [4].


 Video: How did the Enigma Machine Work?



Similar machines
Typex   UK
During WWII, the British counterpart of Enigma was Typex, also known as Type-X. Developed in 1934 it was almost an exact copy of the German Enigma, albeit with some additions, such as a motor-drive and two printers: one at either side.

Typex has 5 rotors, of which only 3 were moving during encipherment. During WWII some Typex machines were configured in such a way that they could be used a Enigma machines. They were used for decrypting Enigma messages once the daily key had been broken.

 More information

  
Typex Mark 23

SIGABA   USA
During WWII, SIGABA was the US' answer to Enigma. Developed in the late 1930s as a joint effort of the US Army and US Navy, it was used for high-level traffic. The machine had 15 cipher wheels – 10 large ones and 5 smnaller ones – and was more complex than Enigma or Typex.

For allied communication during WWII, the machine was downgraded to the so-called Combined Cipher Machine (CCM), so that it became compatible with it British counterpart: Typex CCM. In 1952, it was replaced by KL-7.

 More information

  
SIGABA CCM

NeMa   Switzerland
During WWII, the Swiss Army and diplomatic services used a modified version of the German Enigma K — the commercial Enigma that had been freely available on the open market prior to the war — known as the Swiss Enigma K. After the Swiss found out that the Germans were able to read their diplomatic traffic, they developed their own variant which they named NeMa, or Neue Maschine (new machine).

Although the machine was developed between 1941 and 1943, it was not taken into production until 1946, as a result of which it came too late to be of any importance during the war.

 More information

  
NEMA cipher machine, bolted to the bottom of the transit case

KL-7   USA
Another rotor machine that bares properties of the Enigma, is the American KL-7. Introduced in 1952 as AFSAM 7, the machine was used by the American Armed Forces and by NATO.

It has 8 cipher wheels, or rotors, of which 7 are moving during encipherment. Unlike Enigma, this machine does not have a reflector (UKW). Furthermore, each rotor has 36 contact points at either side, 10 of which are looped back to the input of the drum. It was the first machine to use this so-called re-entry feature.

 More information

  
KL-7 outside the transport case

M125 (Fialka)   USSR
Interestingly, most of the exploitable Enigma weaknesses listed above, were fixed in the Russian M-125 cipher machine, also known as FIALKA, that was introduced in 1956. It has 10 cipher wheels, all of which feature irregular stepping. Furthermore, adjacent rotors move in opposite directions.

The Steckerbrett is replaced by a punched card that allows all possible permutations. It avoids operator mistakes and is installed in seconds. And although the operating principle of Fialka is almost identical to that of the Enigma, on Fialka a letter can be encoded into itself.

This clearly shows that the Russians had a good understanding of Enigma's operating principle, but it also suggests that they knew exactly how its weaknesses had been exploited by the Allied codebreakers during World War II.

 More information
  
Fialka M-125-3 with open lid


 Other rotor-based cipher machines


References
  1. David Hamer: Actions involved in the 'double stepping' of the middle rotor 1
    Cryptologia, January 1997, Volume XX, Number 1.

  2. Arthur Bauer, Funkpeilung als alliierte Waffe gegen Deutsche U-Boote 1939-1945.
    ISBN 3-00-002142-6. The Netherlands, 1997. German. p. 33.

  3. Dr. A. Ray Miller, The Cryptographic Mathematics of Enigma
    NSA. Center for Cryptologic History. USA. 1996. 3rd edition 2002.

  4. Jared Owen Animations, How did the Enigma Machine work?
    YouTube channel Jared Owen, 11 December 2021
    Reproduced here by kind permission from the author.

Further information
Any links shown in red are currently unavailable. If you like the information on this website, why not make a donation?
© Crypto Museum. Created: Tuesday 11 August 2009. Last changed: Monday, 06 June 2022 - 09:02 CET.
Click for homepage