# Enigma Replica – How it works?

## Rotors

The Enigma relies on 3 (or 4) rotors. These rotors encrypt letters one by one as for a classic alphabetic substitution scheme.

One of the main differences in Enigma is that rotors positions change for each letter (each 1 letter for rotor I, each 26th letter for rotor II…). For instance, AAAAAAA $\Rightarrow$ CFRTUIJ. For a single letter encryption, the operator press a touch on the keyboard: it enables a current travelling through the rotors (cables and pins), being reflected through the reflector and being displayed using lamps.

The complexity of the Enigma encryption scheme is increased with the plugboard: it allows the operator to transform each letter in another before the rotors. For decryption, rotors must be replaced in their initial position and the ciphertext will be typed on the Enigma keyboard.

## Number of keys

Germans had 5 rotors with different internal connections (each rotor had 26! possible combinations). The Enigma machine used 3 rotors: there are already 5*4*3=60 possibilities in the rotors distribution. Furthermore, each rotor has 26 initial positions: for 3 rotors, 26*26*26=17576 possibilities. However, with the double stepping mechanism described later, there are less than 17576 rotors combinations… An additional ring setting was set for the first two rotors: it allowed the operator to know where the first rotor would for the second rotor rotation. 26 possibilities for each rotor, 26*26 for the association of both rotors.

The plugboard allows to interconnect two different letters. There are 26 letters in the alphabet. However, the Enigma included only 10 cables: when all cables were used, 6 letters were left unconnected and 10 pairs were enabled.

$26! \Rightarrow \binom{26}{2} \times \binom{24}{2} \times \binom{2}{2} \times \ldots \times \binom{10}{2} \times \binom{8}{2} \times \binom{6}{2} \times \binom{4}{2} \times \binom{2}{2}$

We get rid of 6 impossible combinations:

$26! \Rightarrow \binom{26}{2} \times \binom{24}{2} \times \binom{2}{2} \times \ldots \times \binom{10}{2} \times \binom{8}{2} \Rightarrow \frac{26!}{6! \times 2^{10}}$

However, inverting the 10 cables in the plugboard leads to the same encryption scheme: we must divide the number of possibilities by 10!. For the plugboard, the number of possibilities is:

$\frac{26!}{6! \times 2^{10} \times 10!}=150,738,274,937,250$.

When we combine rotors and plugboard, it leads to $158 \times 10^{18}$ different keys. More explanations are available at: http://www.codesandciphers.co.uk/enigma/enigma3.htm

## Stepping mechanism

A mechanism based on wheels and pawls was used in the Enigma.

When a touch is pressed, the compensator (1) is pushed down. The opposite side of the compensator (2) goes up, taking 3 and pushing the rotor itself: the rotor is incremented by one letter. Furthermore, a ring was fixed on some rotors to enable simulateneous rotations of two rotors. Here is a view of the back side of the Enigma rotors from our Solidworks model:

In the case where the ring will not make the second rotor to rotate:

### Double stepping

Nevertheless, the rotors period is not $26 \times 26 \times 26$ but $26 \times 25 \times 26$ as the second rotor can rotate twice faster on a given location. Here is an example taken from mdedermuller: https://www.instagram.com/p/BDYwoLeEq3m/

## Transmission protocol

1. Daily settings were written in a book changed each month: initial position, rotors to be used, plugboard connections and ring position. Then, it was necessary to set an initial position  for each message: otherwise, if an attacked intercepted lots of messages, he could apply a frequency analysis on each first letter and the second… Settings could be retrieved easily using this method.
2. The operator chose 3 letters “randomly” (for instance, ZSF).
3. Then, he set the rotors/rings positions, day plugboard connections.
4. Then, he encrypted twice the initial position chosen (ZSFZSF $\Rightarrow$ TYUBGJ). It was sent twice to check the integrity of the transmission.
5. Finally, the operator placed rotors in the initial position ZSF and started to write the ciphertext.

The ciphertext was transmitted with the 6-letter settings: the operator just had to open his settings book on the day page, checked the integrity and placed the rotors at ZSF to decrypt the message. Only 6 letters are encrypted with the same initial position: frequency analysis was unefficient. However, position of rotors II and III may not change in 6 letters: it was one breach in the Enigma encryption scheme.