2025-09-04 12:52:37 -04:00
|
|
|
# Enigma Machine
|
2025-10-26 13:34:05 -04:00
|
|
|
Recreates the functionality of the Enigma Machine from World War II. Mainly just an exercise in Python.
|
2025-09-17 04:35:19 -04:00
|
|
|
|
2025-10-26 11:40:29 -04:00
|
|
|
## Usage
|
2025-10-26 13:34:05 -04:00
|
|
|
`uv run main.py "[message]" e|d [int]`
|
|
|
|
|
|
2025-10-26 11:40:29 -04:00
|
|
|
|
2025-10-26 12:14:17 -04:00
|
|
|
Where:
|
2025-10-26 13:34:05 -04:00
|
|
|
- __"[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.
|
2025-10-26 11:40:29 -04:00
|
|
|
|
2025-10-26 13:34:05 -04:00
|
|
|
## TODO
|
|
|
|
|
- [ ] Add a param to tell the `encode` function to use an existing seed file.
|
2025-10-26 11:40:29 -04:00
|
|
|
|