6
$\begingroup$

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?

$\endgroup$
  • $\begingroup$ 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. $\endgroup$ – lpaseen Dec 18 '15 at 21:14
3
$\begingroup$

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.

$\endgroup$
1
$\begingroup$

The easiest way to understand the path of the current through the rotors is to make up six tables for the three wheels, three going forward and three going backwards plus a table for the reflector.

The simulator was used with rotors III, II, I and B reflector. The simulator advances the rotor when the first key is pressed, i.e., the first entry.

To simplify, set the rings to 1, 1, 2. Then when you press the the first key the rotor will have the fixed terminal on the terminals from keyboard matching the letters on the core of the rotor (which contains the fixed wiring of the rotor). The path is rotors I-II-III, reflector, III, II, I. The current path is A-E,E-S,S-G then the reflector gives path G-L, then using reverse tables starting at wheel III, the return path is L-F, F-W, W-N. The result of entering A is the letter N.

For the next A entered, the rotor shifts by one so that the letters on the rotor are shifted relative to the terminals from the keyboard (these are fixed). The letter A from keyboard goes to the A terminal but now goes to letter B on rotor. As before, using the tables, B goes to letter K on rotor but because of the shift goes to terminal J of the next rotor (assuming no shifts of other rotors). Our current path is now J-B, B-D, Reflector D-H, with return path (using reverse tables starting at rotor III) H-D, D-C. Because of the shift of the rotor, the C terminal is opposite the letter D on the core of rotor I.

Letter D on the rotor is wired to G and G is opposite the terminal F because of the shift. Thus the second A will exit as an F.

The rotors used were (for first three letters on rotors )

ROTOR.I.... A-E,B-K,C-M ,.... THE RETURN IS.. A-U,B-W,C-Y ....
ROTOR.II.... A-A,B-J,C-D,....    THE RETURN IS.. A-A,B-J,C-P .....
ROTOR.III.... A-B,B-D,C-F......    THE RETURN IS.. A-T,B-A,C-G....
REFLECTOR (B)... A-Y,B-R,C-U..  

The rotors have a ring on the left-hand side of the rotor which has the 26 letters or numerals. This ring is spring-loaded and can be pulled outward so that it can rotate relative to the main body (the core).

Beneath the ring is a dot on the main body which is fixed. This is usually set to the A position on the rotor. If we want to change the ring setting to B or position 2 then we can do this by pulling out the ring and holding the core at the A position (relative to the fixed keyboard position A), move the ring so that the letter B (or 2) on the ring is opposite the dot on the core. Then release the ring and now we have letter B in the window instead of A. The rotor must now be turned so that the letter A on the ring shows in window. Thus B to A reverses the normal direction of rotor and the Z position of the rotor is now opposite the fixed A terminal.

  .............D..C..B..A..Z..Y..X...........fixed terminals from keyboard .....
  .............D..C..B..A..Z..Y..X...........core of rotor.......................
  .............D..C..B..A..Z..Y..X.........MOVABLE RING.......................... 

Now change to ring setting B (2):

  .............D..C..B..A..Z..Y..X  
  .............D..C..B..A..Z..Y..X  
  .............E..D..C..B..A..Z..Y  

Now rotate so that A shows in the window of the rotor.
This rotates the lower two rows since the ring is engaged.

  .............D..C..B..A..Z..Y..X  
  .........D..C..B..A..Z..Y..X  
  .........E..D..C..B..A..Z..Y   
  ..........................^....  

The dot at A on the middle row which represents the core (where all the wiring is) is now in the B position relative to terminals from the keyboard (top row). Note that the core now has Z next to our A terminal on top row.

The window on lower row shows as A. If we now select a key on keyboard, then this will rotate the rotor so that B will show in the window. The middle row will now have A next to the A terminal from the keyboard.

This is why you can set the rings to 1, 1, 2 on simulator so that we get a read out from the A contact. The 2 setting is equivalent to the B setting.

$\endgroup$
  • $\begingroup$ I tried to format some of this reply. I hope the blocks are still aligned properly. $\endgroup$ – user47922 Jun 27 '17 at 22:12
0
$\begingroup$

Ok, here we go. Let's use Rotor I as an example.

The wiring for this rotor looks like this:

EKMFLGDQVZNTOWYHXUSPAIBRCJ

On every rotor, there originally was a dot, for more detail, read K ROSSER's answer. We need to know the position of this dot. It's always where the ring setting letter is (So, if the ring setting is A, it's where the A is). Since all the wiring tables on Wikipedia assume a ring setting of A, we can find the dot position by finding the position of the a, in case of rotor I, it's the 21. letter. We need to remember this position for later.

The next step is to shift all the letters up the alphabet by one for each letter that we go up in the alphabet. So, if we want ring setting C, we go up by 2 in the alphabet (Start out at A, B = 1; C = 2). Shifting up the alphabet means, an A becomes a B, a B a C, and so on. Each time we shift up the alphabet, we need to add one to the dot position we remembered. We do this addition mod 26 (Or what ever the lenght of your alphabet is).

The last step is to rotate the new wiring, until our ring setting letter is at the postion of our dot.

To go back to our example (Were going to count like this now: 0,1,2; In case your wondering):

Our original wiring is "EKMFLGDQVZNTOWYHXUSPAIBRCJ" We want to get it to the Ringstellung "C".

First, we get the dot position, so we look for the A, which is at position 20. We remember this.

Now we shift all the letters up the alphabet by one for each letter that we go up the alphabet from A to get to our Ringstellung, and add one to our dot position:

A → B:
EKMFLGDQVZNTOWYHXUSPAIBRCJ
↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓
FLNGMHERWAOUPXZIYVTQBJCSDK

dot position + 1 = 21
B → C:
EKMFLGDQVZNTOWYHXUSPAIBRCJ
↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓
GMOHNIFSXBPVQYAJZWURCKDTEL

dot position + 1 = 22

Our new wiring look like this: "GMOHNIFSXBPVQYAJZWURCKDTEL" and our dot position is 22, our ring setting is C, so we want the letter C to be at position 22 in the wiring.

Rotation 1:

GMOHNIFSXBPVQYAJZWURCKDTEL
↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓
LGMOHNIFSXBPVQYAJZWURCKDTE
Rotation 2:

LGMOHNIFSXBPVQYAJZWURCKDTE
↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓
ELGMOHNIFSXBPVQYAJZWURCKDT

C is now at position 22, we have completed all the steps. The final wiring table looks like this:

ABCDEFGHIJKLMNOPQRSTUVWXYZ
↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓
ELGMOHNIFSXBPVQYAJZWURCKDT

Here are a few more examples. Here is a python implementation.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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