Python Forum
Enigma Machine, I need help!
Thread Rating:
  • 3 Vote(s) - 4 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Enigma Machine, I need help!
#10
(Nov-13-2017, 09:27 PM)Larz60+ Wrote: OK, I'll print out the algorithm from a crypto site, and see if I can follow your code
to find the error.

I'll work on this after dinner tonight, but probably will not have an answer until tomorrow.

One suggestion. I don't don't know if you use an IDE for editing your code, but if so and
it has a debugger, you can run your code step by step, watching selected variables as they change.

I use PyCharm and it has a very good debugger. Most IDE's do.

By the way, your code is very neat and well organized,
perhaps you have found your career.

Thank you very much for your help, and also your remark! Yes, I hope I may be able to start a career with programing, just dont know really where to start... Summer jobs would be complicated/boring seen as I dont have the level..

But back to our code: I use PyScripter for programming and it does and a debugger. I used it a couple of times until now, but dont think it can help much, because the error isn't in the code, but in the philosophy...
I do get a decripted message, but it does not correspond with my input... Here is my problem.

I am guessing I have to find the right list for eversing the process, but it didn't work out so far..
What I have done until now, which I copied from the library you sent me is:
def starter():
            """Converts our last character of the inputted text into a cipher"""
            global ENCMESS,c,text,x,Rotor1
            x = text[len(text)-1]
            for cha in char:
                ENCMESS+=1
                if x==cha: break

        def coder(seq,rev,m):
            """Acts as our rotors"""
            global ENCMESS

            if rev==0 or rev==2:
                ENCMESS =(ENCMESS+m)%26
                ENCMESS = seq[ENCMESS-1]%26
                ENCMESS =(ENCMESS-m)%26
            elif rev==1:
                lst=["empty"]*26
                ENCMESS =(ENCMESS+m)%26
                for i,v in enumerate(seq):
                    lst[v-1] = i
                ENCMESS = lst[ENCMESS-1]%26
                ENCMESS =(ENCMESS-m)%26

        def letters():
            """Converts the ciher back to a letter"""
            global ENCMESS
            ENCMESS = char[ENCMESS-1]

        starter()
        coder(Rotor1,0,c)
        coder(Rotor2,0,d)
        coder(Rotor3,0,e)
        coder(Mirror,2,c)
        coder(Rotor3,1,e)
        coder(Rotor2,1,d)
        coder(Rotor1,1,c)
It still doesn't print the right output.. M< supposition from the beginning is still up, while Ia m thinking that it could be the counter switching letters one too much or not enough.. But I'll see and hopoe what you can find out!
Thank you!
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 705 Mar-29-2024, 06:15 PM
Last Post: idev
  Enigma Decoding Problem krisarmstrong 4 833 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