EDIT: The model I'm trying to make is "Enigma 1". I learned initially about it from a book called "Code Book" and then looked at it in detail from its wikipedia page. The rotor wiring and other details from https://en.wikipedia.org/wiki/Enigma_rotor_details
I am trying to make an enigma machine simulating software. I know how the machine works but am having trouble trying to understand what my code's logic should be BEFORE the alphabets get to the reflectors.
Suppose 1, 2 and 3 represent each rotor's settings in an enigma machine (they're what I got from wikipedia):
abcdefghijklmnopQrstuvwxyz
1:ekmflgdqvzntowyhxuspaibrcj
abcdEfghijklmnopqrstuvwxyz
2:ajdksiruxblhwtmcqgznpyfvoe
abcdefghijklmnopqrstuVwxyz
3:bdfhjlcprtxvznyeiwgakmusqo
And suppose the message is "A". Here's what I think should happen: From the first rotor, the message could have become "E" but because the rotors spin by one unit before the encryption, it is encrypted to the next letter in the setting: "K". Now to find what happens in the second rotor, we need to see the 11th letter in the setting (or the letter below K) which is "L". Similarly for the final rotor, we see the 12th letter (below "L") which is "V" and that from my understanding should be what is transferred to the reflector and then back.
Though my software is complete with ring settings, plugboard and all the other stuff and it can decrypt it's own encrypted messages the way it is supposed to, the ciphertext is never the same as what online enigma simulators produce for the same settings, nor can it decrypt original messages even if I know all the settings. If you go here: http://people.physik.hu-berlin.de/~palloks/js/enigma/enigma-u_v20_en.html click "show monitor" button and type "a" you will see that before it reaches the reflector, it is translated as "H". So clearly I'm doing something wrong.
Can somebody please help me out?