Fri Jul 01 2016
Using Java, I created the historical enigma machine from WWII. This was a course project for the course CS 61B - Data Structures.
Some historical background: The Enigma machine was invented by the German engineer Arthur Scherbius at the end of World War I. Though initially invented for commercial use, the Enigma machine gained its fame through its usage by Nazi Germany during WWII. The Enigma lived up to its name, and the Allied Forces found it nigh impossible to crack German codes encrypted using the machine. Fortune favored the Allies, however, when Allied soldiers recovered the Enigma machine from a German U-boat just before it sank. The Allies were finally able to successfully decode German communication using the Enigma machine.
This solo project presented quite a challenge at first. I was given little beyond a very long description of the machine's inner parts (and how they operated) and a very broad skeleton code that simply provided some of the names and descriptions of certain functions that we would need.
At first, I did not know even where I should begin. There were so many parts of the machine to implement and because of the intricate relationship between each of the machine parts it was incredibly difficult to decide which part I should implement first. So, after some thought, I decided to first read through the machine's description again thoroughly and use my understanding to draw a diagram of the machine's inner parts (and how they worked together). I came up with a diagram that looked almost identical to the image below:
A diagram of the Enigma's rotors. The rotors had contact points that would align with those of other rotors to create an electrical pathway.
The original Enigma machine had a keyboard so that when a key (or letter on the keyboard) was pressed, one or more of the rotors would rotate. The contact points on the rotors would align in a way to create an electrical pathway that would lead to (and trigger) a corresponding output letter. Every time the rotors rotated, it would produce a different electrical pathway (so that two consecutive "a" key presses will not produce the same output letter) so as to produce a seemingly unpredictable pattern for encryption. So, knowledge of the Enigma's pattern of rotor rotation was crucial to cracking its code (which is why the recovery of the Enigma machine by the Allied forces was such a critical moment during WWII). There were many other parts to the Enigma machine, but for the purposes of this portfolio description, this will suffice.
It was my job to reproduce this Enigma machine, with all its inner workings, as a purely virtual machine using my knowledge of Object Oriented Programming and my command of Java. Needless to say, the entire process took a considerable amount of time with no small amount of challenge. At the end, however, I learned a lot about OOP through this project and gained my first experience developing a piece of software.