A simulation of the Enigma machine implemented in C#.
- Specify a configuration (rotor wheels, plugboard, reflector, etc)
- Construct a machine from that configuration
- Encipher/decipher text using that machine
For example, the Operation Barbarossa example from the excellent Franklin Heath wiki can be deciphered as follows:
var config = new Configuration();
config.PlugBoard.Add("AV BS CG DL FU HZ IN KM OW RX");
config.Rotors.Add(RotorName.II, RotorName.IV, RotorName.V);
config.Rotors.SetRings(2, 21, 12);
config.Reflector.Name = ReflectorName.RefB;
var machine = config.Create();
machine.Position = "BLA";
var cipherText = "EDPUD NRGYS ZRCXN"; // truncated for brevity
var plainText = machine.Encode(cipherText);
This and other examples may be found in SampleMessageTests.cs
This was made possible by the technical documentation made available by