Monday, December 30, 2019
Plugboard of an Enigma Machine
The Plugboard of an Enigma machine was by far the largest contribution to the number of keys for encrypting messages. If I am not mistaken, given an alphabet of \(n\) letters, the number of ways of connecting, thereby swapping, \(m\) pairs of letters can be computed using this formula: \(\qquad\displaystyle{n \choose 2m}\prod_{0\le k< m}(2m - (2k+1))\) Or, equivalently, \(\displaystyle{n \choose 2m}\frac{(2m)!}{2^{m}\cdot m!}\) During the second world war, the initial Enigma machine used had a configuration of \(n=26\) and \(m=6\). So the number of ways of swapping pairs of letters was: \(\qquad\displaystyle{26 \choose 12}\times 11\times 9\times 7\times 5\times 3\times 1 = 100,391,791,500\) But why did Arthur Scherbius, the inventor of the Enigma machine, chose 6 as the number of pairs for the plugboard? Suppose the plugboard could fit any number of cables (from 1 to 13), what is the relative strength of swapping 6 pairs of letters, compared to, say, 11 pairs? To find out, we can plugin in different values to the above formula. For example, using Sagemath:
n = 26 m = int(n/2) for i in (1..m): print i,'\t', binomial(n, 2*i) * prod( (2*i-(2*j+1)) for j in (0..(i-1)) ) Pairs Ways of connecting 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,289,500 8 10,767,019,638,375 9 53,835,098,191,875 10 150,738,274,937,250 11 205,552,193,096,250 12 102,776,096,548,125 13 7,905,853,580,625As we can see, had the Enigma machine been equipped with a plugboard with 11 cables instead of 6, it would have increased the size of the key space by over two thousand times. On the other hand, it's a waste of resources to have more than 11 cables :)