A module to recreate a digital enigma machine with a working UI and the ability to setup the machine to encrypt/decrypt any messages
The machine class holds all the functions to recreate an enigma machine with an arbitary number of rotors
rotors: a list of strings, each of length 26 representing the mapping from each rotor's input character to the output character
For a rotor with mapping
'dmtwsilruyqnkfejcazbpgxohv'at position 0,awill be mapped tod,bwill be mapped tom, and so on.
msg: the input message to be encrypted/decrypted
reset: if reset is set to True, the rotors will be reset to position 0 after execution
board: a string of length 26 which represents the plugboard mapping. Two letters must map to each other
passing
dbcaefghijklmnopqrstuvwxyzwill configure the plugboard to swapaandd
rot: list of indicies of rotors for which we want to change the position
pos: list of new positions for each corresponding rotor in rot
NOTE: rot and pos must be of the same length
set_rotor_position([1],[1])will set the rotor at index 1 to position 1
After the script is ran, a turtle graphics window will show up. It takes keyboard input from the device and processes it. The encrypted/decrypted characters will show on the screen.
To reset, press the grey square near the bottom
This implementation currently does not support plugboard editing