ibraimgm / enigma

A simple enigma machine in Go
MIT License
8 stars 2 forks source link

Please clarify valid settings #5

Open lordofscripts opened 10 months ago

lordofscripts commented 10 months ago

We know that in the default CLI app only 3 rotors can be used (I,II,III) but that one can "assemble" one with 5 rotors like the latest Enigma machine.

However, I noticed the following while using it:

And what about the Plugboard? in the machine it consisted of key pairs but that doesn't seem to be handled by command-line parameters.

ibraimgm commented 10 months ago

This is a rather old toy project, but I will try to answer as best as I can remember.

The reflector can only be B or C, anything else (A,D, etc.) is flagged as invalid On the M3/M4 enigma, only "B" and "C" reflectors are available, as far as I know. A reflector "A" does indeed exist, and was created for the first enigma, but was discontinued in 1937.

In the source, I also have reflectors B Dünn and B Dünn. As far as I remember, they were "variants" of the B/C reflectors (I think I mad then available on command-line too). You can also implement reflector A easily (the Reflector interface has only 2 simple methods) if you need to.

More info on this: https://people.physik.hu-berlin.de/~palloks/js/enigma/index_en.html#s7

There is no explanation about the Window parameter, what it means, what are valid settings, etc.

This is a tricky one. If I remember right, the window position refers to where the "notch" of the rotor ring is located, and this is needed to know "when" to step the "next" rotor. I don't remember the details, but it was quite tricky to understand. This link may help, but it is not an easy ride: https://www.cryptomuseum.com/crypto/enigma/working.htm

And what about the Plugboard? in the machine it consisted of key pairs but that doesn't seem to be handled by command-line parameters.

You got it right, it is just a "dumb" translation of letter pairs. And yes, I did not add it to the command line just because it was to wordy to add (you would have to input the whole alphabet) and I figured out anyone would hardly ever use that. The exising CreatePlugboard can create a custom plugboard if you need it (or you can implement the interface yourself).

lordofscripts commented 10 months ago

This is what can be said so far comparing the available Enigma description and matching it to your CLI. I will use the Day 20 settings of the Luchtwaffe coding sheet referred previously:

However, while your README explains how to use the program, it does not explain how to make this experiment useful. In other words, we can encrypt using the sample application but there is no explanation HOW the user, can make a round-trip and decrypt the output of your software.