How many possible Enigma machine settings?

I'm trying to calculate the amount of settings the enigma machine has. I have found several sites regarding this topic, but it seems like there are two answers to my question. The first answer is 158,962,555,217,826,360,000 and the second is 107,458,687,327,250,619,360,000. Where the difference is that in the second answer, it has been taken into account that the notched rings on the enigma could be set as well, giving 26 * 26 = 676 more settings than the first answer.

But which answer is the right one, and why? How many possible different Enigma machine settings are there and how can one determine this number?

• Actually, there were a number of different models of Enigma; it's possible that both are right... – poncho May 17 '16 at 14:07

Depends on the exact model. Wikipedia is your friend: "Combining three rotors from a set of five, the rotor settings with 26 positions, and the plugboard with ten pairs of letters connected, the military Enigma has 158,962,555,217,826,360,000 (nearly 159 quintillion) different settings."

More in detail: if you consider an Enigma with 3 rotors out of 5 rotors of model known to the cryptanalyst, and a plugboard with 10 wires

• the 3 rotors out of 5 can be ordered in $${5!\over(5-3)!}=60$$ ways.
• for each rotor, the relative position of the wiring to the rest of the rotor can be set to 26 positions; for $$26^3=17,576$$ combinations.
• each of the 20 extremities of the 10 wires can be plugged into any of 26 positions not otherwise occupied, with the two extremities of a given wire equivalent, as well as the 10 wires themselves; for $${26!\over(26-20)!\cdot2^{10}\cdot10!}=150,738,274,937,250$$ combinations.

There are thus $${5!\over(5-3)!}\cdot26^3\cdot{26!\over(26-20)!\cdot2^{10}\cdot10!}=158,962,555,217,826,360,000$$ possible settings, for a definition of that not including the initial rotor position, even though that's not initially known to the cryptanalyst.

• Well, that seems to pretty much be identical to 159 million million million. Or 159 trillion in the more sensible long scale - it was a European device, remember :P By the way, this would approximate to about a 67 bit key. – Maarten Bodewes Mar 12 '16 at 11:40
• Thanks for the responses! After I wrote the question, I visited wiki and youtube. Next time I will check that before hand! – Mephistopheles Mar 12 '16 at 13:16
• @Mephistophales given the details provided by fgrieu, if you find the answer satisfying, you should accept it. :) – Biv Mar 15 '16 at 16:33
• @Biv-I'm kinda new to the site. How do I do that? – Mephistopheles Mar 15 '16 at 21:18
• Since you wrote the question you should see a "tick" for accept near the numerical rating of the answer. Click on it. You must be logged in, of course. – kodlu Mar 15 '16 at 22:11

The answer depends on the Enigma model, on the number of rotors among which the active rotors are chosen, on the number of wires used for the reflector, and on what one accounts for as part of a setting. The discrepancy between the two numbers around is because the position of the rotors (except the left one, which notch is inactive) can be accounted for - or not.

If we consider an Enigma M3 (as used by German forces at the beginning of WW2) with $r=3$ rotors chosen among $n=5$ rotors of wiring and notch positions known to the cryptanalyst; a plugboard with $w=10$ wires assumed all used; and define a setting as consisting of what's changeable, assumed unknown to the cryptanalyst, and remains constant during a session of use of the Enigma:

• The rotors can be ordered in ${n!\over(n-r)!}=60$ ways (Walzenlage).
• The relative position of the rotor and their internal wiring (Ringstellung) can be set to 26 values; for $26^r=17,576$ combinations.
• On the reflector, each of the $2w$ extremities of the wires can be plugged into any of 26 positions not otherwise occupied, with the two extremities of a given wire equivalent, as well as the wires themselves; for ${26!\over(26-2w)!\cdot2^w\cdot w!}=108,531,557,954,820,000$ reflector settings (Steckerverbindungen).

There are thus $$s={n!\over(n-r)!}\cdot26^r\cdot{26!\over(26-2w)!\cdot2^w\cdot w!}=158,962,555,217,826,360,000$$ settings; that's $\approx1.6\cdot10^{20}\approx2^{67.1}$. This number is often quoted, and makes sense, as that's also the size of the key space according to the basic setup procedure; but this setup procedure has varied in secret ways, effectively increasing the key space.

That definition of setting does not account for the position of the $r$ rotors, which before actual encryption of a message is determined by the setup procedure, and is initially unknown to the cryptanalyst. Accounting for that, there are thus $26^r s$ states of the Enigma hardware when encryption begins.

For the left rotor, the position of the outer of the rotor is immaterial to encryption and decryption. That thus leaves $26^{r-1} s$ plaintext/ciphertext transformations implemented by the Enigma and distinguishable for long-enough messages; that's $\approx1.1\cdot10^{23}\approx2^{76.5}$. This agrees with Graham Ellsbury's Complexity of the Enigma: if a cryptanalyst is able to fully decipher a sizable message sent using an entirely unknown setup procedure, s/he has in effect recovered about $76.5$ bit worth of keying material.

Caution: none of the above numbers is related to the much lower number of operations involved by the attacks actually carried for cryptanalysis during WW2, which exploited weaknesses in both the transformation performed by the Enigma, and its setup procedures.

Note: some parameters and hypothesis used in the above computations are debatable:

• Ultimately, $n=8$ rotors where used for the Naval Enigma according to that source.
• Enigma M4 (Naval version after February 1942) had $r=4$ rotors; but these where not fully interchangeable, so the formula given does not apply.
• I can't tell if the number of wires used in the Steckerverbindungen was always exactly $w=10$, or variable in some range, or/and known to the cryptanalyst.
• Potentially interesting for further reading (and maybe even suitable as a reference too): The Cryptographic Mathematics of Enigma by Dr. A. Ray Miller, The Center for Cryptologic History – National Security Agency. That publication concludes approximately $1\cdot10^{23}$ which I think is close enough to confirm your $1.1\cdot10^{23}$ – e-sushi May 20 '16 at 12:37

protected by e-sushiMay 18 '16 at 15:41

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).