Example Code

Enigma Code Machine Simulator

Code and Documents

Attachment

The Enigma cypher machine was used during WW2 to encode secret messages, and after a breakthrough by Marian Rejewski and the Polish Cipher Bureau the British, the U.S. and their allies were able to to break the code, enabling them to win the war. 

see:

https://en.wikipedia.org/wiki/Cryptanalysis_of_the_Enigma?oldformat=true#Polish_breakthrough

 

Although they used the first big digital computers, and the Enigma machine was quite simular to commercially available machines produced before the war, the effort was not very successful until the allies captured a code-book that showed how the machines were set up.

 

The Enigma machine resembles a typewriter and has several code-wheels that can be re-arranged and adjusted to vary the coding algorithm.  The example shown has three code wheels, a "reflector" wheel, and a plug-board, all of which were set up each day according to a code-book that every operating unit had.  The message was then typed into the keyboard and a corresponding light illuminated above the keyboard, showing the encrypted letter.

 

An excellent web site explaining its history and inner workings can be found at

 

http://users.telenet.be/d.rijmenants/en/enigmasim.htm

 

An good simulator program and example code books can be downloaded there.

 

The enclosed LabView application goes a step further by graphically showing the path of the signal as it passes through the machine.  To use it:

 

1.    Place the Enigma.vi, the two sub-vi's, and the .wav file in the same directory.

 

2.    Before starting the .vi, choose the numbered rotor for each of the 3 positions plus the Reflector # using the Rotor and Reflector # drop-down controls at the top of the columns.

 

3.    Choose each rotor's internal setting with the adjacent drop-down control.

 

4.    Arrange the plug-board using the controls in the right-most column.

 

5.    Start the .vi and set the initial code wheel positions using the controls in the upper right corner.

 

6.   Type the message using your computer's keyboard (LETTERS ONLY, NO SPACES).  Hold each key down for about 1 second before typing the next letter.

 

7.    The input and output will appear in the indicators on the right side of the front panel.  (The signal path starts at the right side, goes through the 3 code wheels, bounces through the reflector, then passes through the code wheels again, ending up in the right column.  The positions of the code-wheels are advanced each time a letter is entered.)

 

8.    Interestingly, the coding and the de-coding of the messages are done in exactly the same way.  If you re-start the .vi and type in the coded message, the original message will re-appear.

 

Machines that were similar in appearance were still being used by the military as late as the 1970's, becoming obsolete only after digital computers were introduced.

Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.

Comments
hwalt713
Member
Member
on

Starting the .vi will reset the code wheel positions to 01-01-01, so set the initial wheel positions AFTER you start the .vi.

Muri777
Member
Member
on

did you write this? this is pretty impressive. how long did it take

Contributors