3 ms·
There's a minor problem with the implementation. The rotors and reflector always turned a letter into a different letter because of the wiring. It's possible fo
by jgrahamc 12y ago
There's a minor problem with the implementation. The rotors and reflector always turned a letter into a different letter because of the wiring. It's possible for the shuffling of the alphabet to leave a letter in place.
This is a minor flaw for the explanation but the result was that a letter could never be enciphered to itself on Enigma. And this fact was exploited because it meant that crib positions could be eliminated.
- charypar 12y agoThat property is caused by the reflector, rotors themselves can shuffle randomly. The way the reflector is built in the implementation is from pairs of consecutive (unique) letters of the shuffled alphabet (getting a half of the reflector) and then merging the inversion. IMHO it's correct.
- jgrahamc 12y agoHmm. Rereading the code I believe you are correct. I'm not strong in Ruby and had misunderstood what this was doing: Reflector = Hash[*('A'..'Z').to_a.shuffle] Reflector.merge!(Reflector.invert)