Replaced encode and decode with a single function, excode, that accepts a parameter for encode/decode and handles both actions.
Enigma Machine
Recreates the functionality of the Enigma Machine from World War II. Mainly just an exercise in Python.
Usage
uv run main.py "[message]" e|d [int]
Where:
- "[message]" is the message to be encrypted/decrypted. Should be in quotes.
- e|d is the direction of the message (encrypt or decrypt).
- int is the number of iterations to be made.
Seed Values
When encrypting a message, a file will be written to the current directory. This file contains the seed values used to generate the encryption/decryption keys.
The seed values are integers between 0 and 58. In the file, each seed value is on a new line.
The number of iterations should match the number of seed values used.
Examples
Encode
Encode the message "You are here." with three iterations.
uv run main.py "You are here." e 3
The command above will create a file called "seed_values.txt" with the generated seed values.
Decode
Decode the message "NTb!QDbGDQDa" with three iterations.
uv run main.py '.NTb!QDbGDQDa' d 3
The command above expects a file called "seed_values.txt" with the seed values used to encode the message from the preceding example.
TODO
- Add a param to tell the
encodefunction to use an existing seed file.