I wanted to programm the enigma (using C#). But it seems like i dont understand how the rotors work. Becouse if we take the first three rotors:

  1. ekmflgdqvzntowyhxuspaibrcj
  2. ajdksiruxblhwtmcqgznpyfvoe
  3. bdfhjlcprtxvznyeiwgakmusqo UKW A: ae bj cm dz fl gy hx iv kw nr oq pu st (The meaning of the possitions are from a-z oc).

So if we take the route of A now: a-e; e-s; s-g; g-y; y-q; q-q; q-x; x= encrypted output.

Now lets go back again: x-r; r-g; g-c; c-m; m-z; z-e; e-l; l = decrypted output

So where is my logical problem?


When the signal goes back through the rotors after the reflector, the permutation for each rotor is inverted. That's what you're missing.

In a way, this is kind of obvious: if going through the rotor one way would map, say, A to E, then going through it the other way has to map E to A, and so on.

(The permutation applied by the reflector itself is always, by design, its own inverse; it just swaps distinct pairs of letters.)

| improve this answer | |
  • $\begingroup$ Hmm but if i go back than x-k; k-d; d-g which is again wrong or am i missing still smth? $\endgroup$ – Stefan xyz Sep 7 '18 at 13:33
  • $\begingroup$ okay nevermind its correct ty $\endgroup$ – Stefan xyz Sep 12 '18 at 16:33

Not the answer you're looking for? Browse other questions tagged or ask your own question.