Python Forum
Enigma Machine, I need help!
Thread Rating:
  • 3 Vote(s) - 4 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Enigma Machine, I need help!
#3
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.

#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 1
full 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.
Reply


Messages In This Thread
Enigma Machine, I need help! - by Kimkuq - Nov-12-2017, 07:15 PM
RE: Enigma Machine, I need help! - by Larz60+ - Nov-12-2017, 10:37 PM
RE: Enigma Machine, I need help! - by AceScottie - Nov-13-2017, 05:00 AM
RE: Enigma Machine, I need help! - by Kimkuq - Nov-13-2017, 06:29 PM
RE: Enigma Machine, I need help! - by Larz60+ - Nov-13-2017, 06:36 PM
RE: Enigma Machine, I need help! - by Kimkuq - Nov-13-2017, 06:42 PM
RE: Enigma Machine, I need help! - by Larz60+ - Nov-13-2017, 06:45 PM
RE: Enigma Machine, I need help! - by Kimkuq - Nov-13-2017, 08:22 PM
RE: Enigma Machine, I need help! - by Larz60+ - Nov-13-2017, 09:27 PM
RE: Enigma Machine, I need help! - by Kimkuq - Nov-13-2017, 10:09 PM
RE: Enigma Machine, I need help! - by Kimkuq - Nov-14-2017, 05:38 PM
RE: Enigma Machine, I need help! - by Larz60+ - Nov-14-2017, 05:47 PM
RE: Enigma Machine, I need help! - by Kimkuq - Nov-14-2017, 06:25 PM
RE: Enigma Machine, I need help! - by Larz60+ - Nov-15-2017, 12:54 AM
RE: Enigma Machine, I need help! - by sparkz_alot - Nov-15-2017, 02:26 PM
RE: Enigma Machine, I need help! - by Larz60+ - Nov-16-2017, 06:08 AM
RE: Enigma Machine, I need help! - by sparkz_alot - Nov-16-2017, 02:02 PM
RE: Enigma Machine, I need help! - by Kimkuq - Nov-16-2017, 09:56 PM
RE: Enigma Machine, I need help! - by Larz60+ - Nov-17-2017, 04:23 AM
RE: Enigma Machine, I need help! - by Larz60+ - Nov-17-2017, 10:08 PM
RE: Enigma Machine, I need help! - by Larz60+ - Nov-18-2017, 01:48 AM
RE: Enigma Machine, I need help! - by Kimkuq - Nov-18-2017, 10:09 PM
RE: Enigma Machine, I need help! - by Larz60+ - Nov-19-2017, 01:40 PM
RE: Enigma Machine, I need help! - by Larz60+ - Nov-19-2017, 10:06 PM
RE: Enigma Machine, I need help! - by Larz60+ - Nov-20-2017, 05:45 PM
RE: Enigma Machine, I need help! - by Kimkuq - Nov-20-2017, 08:28 PM
RE: Enigma Machine, I need help! - by Larz60+ - Nov-21-2017, 01:53 AM
RE: Enigma Machine, I need help! - by sparkz_alot - Nov-21-2017, 02:21 AM
RE: Enigma Machine, I need help! - by Larz60+ - Nov-21-2017, 11:50 AM
RE: Enigma Machine, I need help! - by Larz60+ - Nov-21-2017, 10:36 PM
RE: Enigma Machine, I need help! - by Kimkuq - Nov-22-2017, 09:18 AM
RE: Enigma Machine, I need help! - by sparkz_alot - Nov-21-2017, 11:52 PM
RE: Enigma Machine, I need help! - by Larz60+ - Nov-22-2017, 11:00 AM
RE: Enigma Machine, I need help! - by sparkz_alot - Nov-22-2017, 02:20 PM
RE: Enigma Machine, I need help! - by Larz60+ - Nov-22-2017, 04:24 PM
RE: Enigma Machine, I need help! - by sparkz_alot - Nov-22-2017, 05:12 PM
RE: Enigma Machine, I need help! - by Larz60+ - Nov-22-2017, 08:32 PM
RE: Enigma Machine, I need help! - by Kimkuq - Nov-22-2017, 09:03 PM
RE: Enigma Machine, I need help! - by sparkz_alot - Nov-22-2017, 08:48 PM
RE: Enigma Machine, I need help! - by Larz60+ - Nov-22-2017, 08:51 PM
RE: Enigma Machine, I need help! - by sparkz_alot - Nov-22-2017, 09:01 PM
RE: Enigma Machine, I need help! - by Larz60+ - Nov-22-2017, 09:06 PM
RE: Enigma Machine, I need help! - by sparkz_alot - Nov-22-2017, 09:28 PM
RE: Enigma Machine, I need help! - by Larz60+ - Nov-22-2017, 10:41 PM
RE: Enigma Machine, I need help! - by Larz60+ - Nov-24-2017, 09:18 PM
RE: Enigma Machine, I need help! - by Larz60+ - Nov-24-2017, 11:48 PM
RE: Enigma Machine, I need help! - by Larz60+ - Nov-25-2017, 05:09 AM
RE: Enigma Machine, I need help! - by Larz60+ - Nov-26-2017, 11:31 AM
RE: Enigma Machine, I need help! - by sparkz_alot - Nov-26-2017, 01:56 PM
RE: Enigma Machine, I need help! - by Kimkuq - Nov-26-2017, 09:53 PM
RE: Enigma Machine, I need help! - by Larz60+ - Nov-27-2017, 03:03 AM
RE: Enigma Machine, I need help! - by Larz60+ - Nov-28-2017, 08:29 PM
RE: Enigma Machine, I need help! - by Larz60+ - Nov-29-2017, 01:42 AM
RE: Enigma Machine, I need help! - by sparkz_alot - Dec-02-2017, 02:20 PM
RE: Enigma Machine, I need help! - by Larz60+ - Dec-02-2017, 02:50 PM
RE: Enigma Machine, I need help! - by Larz60+ - Dec-04-2017, 01:49 AM
RE: Enigma Machine, I need help! - by Kimkuq - Dec-06-2017, 09:58 PM
RE: Enigma Machine, I need help! - by Larz60+ - Dec-06-2017, 11:04 PM
RE: Enigma Machine, I need help! - by Larz60+ - Dec-07-2017, 02:08 PM
RE: Enigma Machine, I need help! - by Larz60+ - Dec-08-2017, 11:35 AM
RE: Enigma Machine, I need help! - by Larz60+ - Dec-16-2017, 02:08 PM
RE: Enigma Machine, I need help! - by Larz60+ - Dec-18-2017, 05:53 AM
RE: Enigma Machine, I need help! - by Kimkuq - Dec-18-2017, 09:06 PM
RE: Enigma Machine, I need help! - by Larz60+ - Dec-19-2017, 03:26 AM
RE: Enigma Machine, I need help! - by Larz60+ - Dec-23-2017, 02:22 AM
RE: Enigma Machine, I need help! - by sparkz_alot - Dec-23-2017, 02:19 PM
RE: Enigma Machine, I need help! - by Larz60+ - Dec-27-2017, 08:26 PM
RE: Enigma Machine, I need help! - by sparkz_alot - Dec-27-2017, 09:27 PM
RE: Enigma Machine, I need help! - by Larz60+ - Dec-28-2017, 01:49 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Numeric Enigma Machine idev 9 712 Mar-29-2024, 06:15 PM
Last Post: idev
  Enigma Decoding Problem krisarmstrong 4 835 Dec-14-2023, 10:42 AM
Last Post: Larz60+

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020