1 unstable release
new 0.1.0 | Jan 11, 2025 |
---|
#274 in Cryptography
7KB
98 lines
Enigma Simulator in Rust
This project is a simple implementation of the Enigma machine in Rust. It allows users to input a message, configure the rotor and reflector settings, and encrypt or decrypt the message.
Installation
Ensure you have Rust installed on your system. If not, install it using rustup:
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
After installing Rust, install the crate:
cargo install enigmify
Usage
Run the program:
enigmify
The program will prompt you to enter:
- The message to encrypt.
- The wiring configuration for rotor 1.
- The wiring configuration for rotor 2.
- The wiring configuration for the reflector.
Example input:
Enter the message to encrypt:
HELLO
Enter rotor 1 wiring:
EKMFLGDQVZNTOWYHXUSPAIBRCJ
Enter rotor 2 wiring:
AJDKSIRUXBLHWTMCQGZNPYFVOE
Enter reflector wiring:
YRUHQSLDPXNGOKMIEBFZCWVJAT
Example output:
Encrypted: ZEBBW
Decrypted: HELLO
How It Works
- The rotors shift characters based on predefined wiring and rotate with each encryption step.
- The reflector substitutes letters in a symmetric manner.
- The encryption process is reversible, meaning decrypting an encrypted message with the same settings will return the original message.
License
This project is licensed under the MIT License.