Kenn Kitchen a30e010c5c Replaced encode and decode with excode.
Replaced encode and decode with a single function, excode, that accepts
a parameter for encode/decode and handles both actions.
2025-10-27 09:03:24 -04:00
2025-09-04 12:52:37 -04:00

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 encode function to use an existing seed file.
Description
A Python coding exercise inspired by the Enigma Machine of World War II.
Readme 47 KiB
Languages
Python 100%