Simulate an Enigma Machine
image missing
commons.wikimedia.org/wiki/File:EnigmaMachineLabeled.jpg

Purpose

The purpose of this problem is to learn Python3 programming by creating an Enigma machine simulation.

There are several Enigma machine simulations available on the web. After you have created your own simulation, examine the other programmers approach to the problem. This can be a great learning experience.

Introduction

The Enigma machine is a cipher device developed in the early-to-mid-20th century to protect commercial, diplomatic, and military communication If plaintext is entered, encoded ciphertext is generated. If ciphertext is entered, plaintext is generated. It was extensively used by the Germany military in WWII.

The system depended on a set of machine settings that were usually changed daily during the war. The settings were for rotor starting position and plugboard configuration.

Note: the Enigma machine only encoded capitol letters (A - Z)
   - lowercase letters were not allowed
   - numbers were spelled out (one, two, ...)
   - unprintable characters were never transmitted
   - punctuation, spaces, etc. where replaces by an 'X'
   - This was good enough for text messages

Project #1

Simulate an Enigma machine as used by the German army in WWII. This includes ...

  1. Allow the user to enter a string of plaintext and generate ciphertext
  2. Allow the user to enter a string of ciphertext and generate plaintext
  3. Limit the size of the input string to some reasonable amount (60 characters?)
  4. Simulate a set of (3) rotors for the Enigma machine
  5. Allow the user to set the rotors starting position
    (as a soldier would have done in WWII)
  6. Simulate a plugboard for the Enigma machine
  7. Allow the user to configure the plugboard
    (as a soldier would have done in WWII)

Things to Think About

Initially the Enigma machine configuration (rotors and plugboard) should be hard coded in the program.

Add the capability to modify the configuration after the first part is working.

Perhaps, at some point, the Enigma machine's configuration could be read from a file. If so, what format to use? (JSON, CSV, ...)

In the real world, extensive documentation on how to configure the Enigma machine would be created. (For this project, not so much.)

Project #2

Expand project #1 to ...

  1. Allow the user to enter a plaintext file and generate a ciphertext file
  2. Allow the user to enter a ciphertext file and generate a plaintext file

Project #3

Create a GUI for your Enigma machine simulation. See PySimpleGUI or PyQt. (Note: There are other Python GUI toolkits.)

Links

How the Enigma machine works | Animation (YouTube)
The Enigma Code (youTube)
The Inner Workings of an Enigma Machine (YouTube)
How did the Enigma machine work?
Enigma Simulator v7.0
Enigma machine (Wikipedia)
Enigma machine & Rotors (Wikipedia)
Enigma rotor details (Wikipedia)
Technical Details of the Enigma Machine
Enigma wiring (Crypto Museum)
The Enigma Machine (stanford.edu)
The components of the Enigma machine
The Enigma Enigma: How The Enigma Machine Worked

Enigma Machine Emulator
Enigma machine