Cryptography Stack Exchange is a question and answer site for software developers, mathematicians and others interested in cryptography. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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 site wont allow me too add more links but google "enigma rotor details" and see the wikipedia page

There is a similarly worded question here but it doesn't answer mine.

I am trying to make an enigma simulator. I have finished doing everything except the ring settings. How do they affect the substitutions?

For example suppose the initial rotor settings are:

abcdefghijklmnopqrstuvwxyz
ekmflgdqvzntowyhxuspaibrcj

I think by applying the ring setting of B or 2, the settings should become:

abcdefghijklmnopqrstuvwxyz
kmflgdqvzntowyhxuspaibrcje

I think all I should have to do is add the ring positions to the rotor positions. But that doesn't seem to be the case. I tried decrypting the first sample message from here that way but didn't succeed. I even tried to make the program run in a loop till it finds the intended answer so I could deduce the relation between ring settings and rotor positions, but it never found it.

But using the same settings on an online enigma simulator worked. Everything seems to be the same except that according to the online simulator, the rotor wirings on a ring setting of b or 2 should be:

abcdefghijklmnopqrstuvwxyz
kflngmherwaoupxziyvtqbjcsd 

How on earth did it turn into that?

share|improve this question
    
I'm working on a physical enigma simulator and I'm as confused as you about what this online simulator shows in it's monitoring window. At first I was thinking it's changing around so much because it is coming from the other direction or something but I can't get it to add up. However I did look at page 15 in users.telenet.be/d.rijmenants/Enigma%20Sim%20Manual.pdf and there it makes things a little clearer on how the ring setting impacts the (de/en)cryption. – user3553030 Dec 18 '15 at 21:14

There's two missing pieces. First, the ring setting changes the output letter, it doesn't rotate the whole exit pattern. Second, the rotors are advanced before the letter is encrypted.

If your rotor (Enigma I Rotor I) is set up like this with the ring at A.

abcdefghijklmnopqrstuvwxyz
ekmflgdqvzntowyhxuspaibrcj

Then if you advance the ring to B all the outputs will be shifted up the alphabet by one. A will become F instead of E. B will become L instead of K. And so on.

abcdefghijklmnopqrstuvwxyz
flngmherwaoupxziyvtqbjcsdk

This almost matches the simulator, but why is the simulator's output shifted over one?

abcdefghijklmnopqrstuvwxyz
kflngmherwaoupxziyvtqbjcsd

Remember that, when depressing a key, the rotors advance before the electrical signal runs through the rotors. Therefore, to examine the current flow through the rightmost rotor in A position, the rotor must be set in the Z position before depressing the key (this also counts for the other rotors if they are due to step).

Source: Technical Details of the Enigma Machine

When you press A the rotor advances to B and encrypts the letter according to B. Your simulator has to first advance the rotor and then encrypt the letter.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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