Enigma: Theorie Rotors 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:


ekmflgdqvzntowyhxuspaibrcj
ajdksiruxblhwtmcqgznpyfvoe
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.)