ultra
is a Rust implementation of the [Enigma machine] that includes the
ability to decrypt ciphertext.
ultra
can be installed from [crates.io] using Cargo:
$ cargo install ultra
Encrypt a message with rotors 1-4-2
, key setting D-O-G
, and ring setting C-A-T
:
bash
$ ultra --rotor=142 --key=DOG --ring=CAT "The quick brown fox jumps over the lazy dog."
Ntz ntqlz jmwll art bbnow wzqk keq ievk lzo.
Encrypt a message using random Enigma settings:
bash
$ ultra --randomize "The quick brown fox jumps over the lazy dog."
Kxj mcwzf oqgmz pwr vnfqq iwhv wcr qqgt lgd.
(Rotors: 314, Key Setting: NHO, Ring Setting: VTB)
Decrypt the ciphertext generated in the first example:
bash
$ ultra --decrypt "Ntz ntqlz jmwll art bbnow wzqk keq ievk lzo."
The quick brown fox jumps over the lazy dog.
(Rotors: 142, Key Setting: BZG, Ring Setting: ALT)
Note: Decryption relies on quadgram frequencies to infer the original Enigma machine settings; as a result, it is very likely that short messages will be decrypted incorrectly. Additionally, decryption will not work for messages that were encrypted with any plugboard plugs active.
This project's quadgram data and decryption algorithm is based on [James Lyons'] articles about the Enigma machine.
ultra
is licensed under the MIT License.