Nov-13-2017, 05:00 AM
(This post was last modified: Nov-13-2017, 05:01 AM by AceScottie.)
I dont fully understand the enigma machine however i did create a working version in python
there are 3 keys which represent the encoder used
to use the file, save it and run 'python file.py inputstring 0 0 0 encrypt'
That should create you a random key, encrypt the inputstring with that key, the print the output and key into the terminal
'input is input k1 = 3 k2 = 19 k3 = 1 and output is ['n', 'l', 'g', 'e', 'w']'
to decrypt simply put the encrpted text and key into the same process and set it to decrypt mode
'python file.py nlgew 3 19 1 decrypt'
input is nlgew k1 = 3 k2 = 19 k3 = 1 and output is ['i', 'n', 'p', 'u', 't']
the way to encrypt and decrypt is the exact same almost to a point.
I and taking the value from key1 * key2 * key3 and then using modulo to find the letters offset.
https://pastebin.com/XzbhFJSF
the only difference between encrypting the data and encrypting it is as simple as + or -
additional, if you mix the alphabet up you will get a completely different key that should still work in reverse
Edit:
Also, Thanks this was a pretty fun project to work on.
there are 3 keys which represent the encoder used
to use the file, save it and run 'python file.py inputstring 0 0 0 encrypt'
That should create you a random key, encrypt the inputstring with that key, the print the output and key into the terminal
'input is input k1 = 3 k2 = 19 k3 = 1 and output is ['n', 'l', 'g', 'e', 'w']'
to decrypt simply put the encrpted text and key into the same process and set it to decrypt mode
'python file.py nlgew 3 19 1 decrypt'
input is nlgew k1 = 3 k2 = 19 k3 = 1 and output is ['i', 'n', 'p', 'u', 't']
the way to encrypt and decrypt is the exact same almost to a point.
I and taking the value from key1 * key2 * key3 and then using modulo to find the letters offset.
#aplah is a list of the alphabet # keys are a global variable encryption = key3 * key2 * key1 # creates a number between 0 and 15625 pos = alpha.index(L) # finds the position of the letter in the alphabet eL = alpha[(pos + encryption)%26] # adds the result of the keys to the position of the letter while looping arround the alphabet key_increment() #increments the key by 1full code:
https://pastebin.com/XzbhFJSF
the only difference between encrypting the data and encrypting it is as simple as + or -
additional, if you mix the alphabet up you will get a completely different key that should still work in reverse
Edit:
Also, Thanks this was a pretty fun project to work on.