Python Forum
Enigma Machine, I need help! - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: Enigma Machine, I need help! (/thread-6259.html)

Pages: 1 2 3 4 5 6 7


RE: Enigma Machine, I need help! - Larz60+ - Dec-16-2017

I just got some new documentation that I sent for (includes taking an Enigma apart, and
explaining how each piece works) and much more. As soon as I finishing reading the applicable
sections, I'll pick this up again.


RE: Enigma Machine, I need help! - Larz60+ - Dec-18-2017

Start on this again tomorrow


RE: Enigma Machine, I need help! - Kimkuq - Dec-18-2017

(Dec-18-2017, 05:53 AM)Larz60+ Wrote: Start on this again tomorrow

Many thanks!


RE: Enigma Machine, I need help! - Larz60+ - Dec-19-2017

Ok, I watched a video that came with the cd that I bought (from arrl.org, titled The Story of Enigma, History, Technology & Deciphering)
Once again, I am confident that I know how it works, but this time I see where I went wrong before, so I feel (as i said) confident, and will
feel so until ... perhaps I no longer am again!


RE: Enigma Machine, I need help! - Larz60+ - Dec-23-2017

The github account is currently empty. I will create a push in the next few days.
Meanwhile, I have been reading the material I received from an ARRL.org purchase,
and have been in contact with a collector who has several original enigma's.
I wanted to post tonight, because I have found the most excellent simulator. This must have taken
a very long time and a lot of effort to create.
When I say excellent, I mean just that. See for yourself and download from: http://users.telenet.be/d.rijmenants/en/enigmasim.htm
More soon


RE: Enigma Machine, I need help! - sparkz_alot - Dec-23-2017

(Dec-23-2017, 02:22 AM)Larz60+ Wrote: When I say excellent, I mean just that.

You are absolutely correct. I haven't downloaded the file (yet), but I did glance through the user manual. If the same level of thought and attention to detail is as present in the software as it is in the manual, you're right, it must have taken the author a mighty effort.


RE: Enigma Machine, I need help! - Larz60+ - Dec-27-2017

After all this time, this is kind of a cop out, but one with a solution.
I certainly did learn a lot about the enigma machine during the process.

As it turns out, there was already an enigma cipher/decipher algorithm available.
So here's a synopsis on how to use it:
  • Install package pycipher with
    pip install git+git://github.com/jameslyons/pycipher
  • Set up and use as in sample below (which contains an alpha to num and num to alpha functions for
       help in conversion of ringstellung and window settings.

This returns the proper code 'GVYWHF' for 'ENIGMA'
when

window = 'Q', 'u', 'O' (left to rih=ght)
rotors =  V, III, and I (left to right)
plugboard = M <--> Z and N <--> S
Rings set to 12, 4, 8 ('L', 'D', 'H')
Reflector = 'B'


import pycipher
import string


def num_to_letter(nums):
   """
   Convert number of alphabet to characters
   :param nums: list of numbers, 1 based
   :return: list of letters
   """
   alpha = string.ascii_uppercase
   alst = []
   for num in nums:
       alst.append(alpha[num - 1])
   return alst

def letter_to_num(letters):
   """
   Convert letters of alphabet to numbers
   :param letters: list of letters
   :return: list of numbers, 1 based
   """
   alpha = string.ascii_uppercase
   nlst = [ ]
   for letter in letters:
       nlst.append(alpha.index(letter) + 1)
   return nlst

if __name__ == '__main__':
   se = pycip = pycipher.Enigma(settings=('Q', 'U', 'O'),
                           rotors=(5, 3, 1),
                           reflector='B',
                           ringstellung=('L', 'D', 'H'),
                           steckers=[('M', 'Z'), ('N', 'S')])

   print(se.encipher('ENIGMA'))
   se.reset_settings()
   print(se.encipher('GVYWHF'))
Results:
Output:
GVYWHF ENIGMA



RE: Enigma Machine, I need help! - sparkz_alot - Dec-27-2017

Doesn't look like he has a real cool gui though.


RE: Enigma Machine, I need help! - Larz60+ - Dec-28-2017

That's true.
But it's code that can be imported as a base.
As I stated earlier, twenty years ago, I would have solved this while sleeping,
But my attention span is a lot shorter now, and I don't like to admit it, but I was trying to
recreate the wheel.

Perhaps Kimkuq can use the plugboard code format (not necessarily the graphics), to do the graphics
portion. After looking at the great presentation of http://users.telenet.be/d.rijmenants/en/enigmasim.htm,
there's not much room for improvement.