2
$\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 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?

$\endgroup$
3
$\begingroup$

I guess you already figured it out but my guess is that you forgot to move the first rotor 1 step before starting the encryption. That also impacts what letter it arrives to on next rotor and so on.

The complete path is

KBD-A>SB>A - A>ETW>A - B>(1)R3>K - J>(2)R2>B - B>(3)R1>D - D>UKW>H 
  - H>(3)R1>D - D>(2)R2>C - D>(1)R3>G - F>ETW>F - F>SB>F-light

Keyboard A arrives to plugboard (Steckerbrett) as A, leaves the plugboard as A, arrives to Entry wheel as A, leaves as A, arrives to the first rotor at level B, gets rewired to K and so on. Typing 3 more "A" gives

 A>SB>A - A>ETW>A - C>(1)R3>M - K>(2)R2>L - L>(3)R1>V - V>UKW>W
       - W>(3)R1>R - R>(2)R2>G - I>(1)R3>V - T>ETW>T - T>SB>T  :T

 A>SB>A - A>ETW>A - D>(1)R3>F - C>(2)R2>D - D>(3)R1>H - H>UKW>D
    - D>(3)R1>B - B>(2)R2>J - M>(1)R3>C - Z>ETW>Z - Z>SB>Z  :Z

 A>SB>A - A>ETW>A - E>(1)R3>L - H>(2)R2>U - U>(3)R1>K - K>UKW>N
    - N>(3)R1>N - N>(2)R2>T - X>(1)R3>Q - M>ETW>M - M>SB>M  :M
$\endgroup$
1
$\begingroup$

For any one that follows, two tips:

  1. If the Enigma I is set up with the most predictable settings: rotors 1-2-3, in that order, all in the A position; if you type in AAAAA you should get BDZGO. That's a good first simple test. Not to mention deciphering BDZGO back to AAAAA.
  2. Find an existing online simulator; use it to replicate your encipherment, if your results are the same then you're on the right track (or replicating their errors).
$\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.