Updated README and cleaned up the code some. Added type hints.

This commit is contained in:
Kenn Kitchen
2025-10-26 13:34:05 -04:00
parent f8b5b6b577
commit bc49b72c9e
2 changed files with 54 additions and 52 deletions

View File

@@ -1,18 +1,38 @@
# Enigma Machine
Recreates the functionality of the Enigma Machine from World War II.
Recreates the functionality of the Enigma Machine from World War II. Mainly just an exercise in Python.
## Usage
`uv run main.py [0-58] [0-58] [0-58] '[message]' 'e|d' [int]`
`uv run main.py "[message]" e|d [int]`
Where:
- 0-58 [integer] is the first seed value
- 0-58 [integer] is the second seed value
- 0-58 [integer] is the third seed value
- message is the message to be encrypted/decrypted
- e|d is the direction of the message (encrypt or decrypt)
- int is the number of iterations to be made (not yet implemented)
- __"[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.
## Examples
`uv run main.py 32 15 1 'This is a test.' 'e' 3`
### 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 `encode` function to use an existing seed file.
`uv run main.py 32 15 1 'Uijt!jt!b!uftu' 'd' 3`