Enigma
Programming challenge to recreate the engima machine and decode some messages
Install / Use
/learn @caadam/EnigmaREADME
Enigma

1 Introduction
1.1History
The Enigma machines were a series of electro-mechanical rotor cipher machines developed and used in the early- to mid-twentieth century to protect commercial, diplomatic and military communication. Enigma was invented by the German engineer Arthur Scherbius at the end of World War I. Early models were used commercially from the early 1920s, and adopted by military and government services of several countries, most notably Nazi Germany before and during World War II. Several different Enigma models were produced, but the German military models are the most commonly recognised.
Credit : https://en.wikipedia.org/wiki/Enigma_machine
Figure 1: M3 Enigma Machine. credit : www.cryptomuseum.com
1.2 Relevance
The Enigma machine, while flawed, was sufficiently complex that it couldn't be cracked efficiently, reliably and most importantly, in a timely manner by humans. The solution was an electro-mechanical machine called a Bombe which set the foundation for modern computers and the concepts of programming. The Bombe and it's crypt-analysis techniques subsequently contributed to the creation of Colossus, the world's first digital, programmable computer. Attacking the Enigma was the driver for modern computing.
1.3 Key objectives
This project represents a tool to measure your current level of developer skills. We are looking at both your technical skills and professional soft skills. Specifically, we will be monitoring and guiding you in the following areas:
- Technical Skills. Whatever your current skill level, we'll make you better. As you progress we will review your code and provide feedback and suggest changes.
- Managing complexity. Junior developers often attempt to solve a problem in an overly complex way. A simple and clean solution is a better solution.
- Ability to manage your time and client timeframes. We need to you start understanding your time and that of your mentor(s) is finite and has a significant dollar value attached to it. We need you to learn to manage your time, manage deadlines and be efficient.
- Your ability to communicate. You'll have to communicate back to your mentors about your progress and your understanding of the Enigma problem.
- Using failure to your advantage. We want you to fail fast and learn.
- Just in time learning. Chances are you won't have all the skills you need to implement this project to a level we'll be happy with. You'll have to learn 'on-the-job' through whatever mechanism works for you. This is an essential skill for your future success at Microsoft.
1.3.1 Understand a complex problem
The Enigma machine represents a complex mechanical device that translates well into code. You are expected to learn and understand the components of an Enigma machine and how they physically operate. Specifically, you will learn the inner workings of a M3/M4 German Enigma machine.
1.3.2 Decompose a complex problem into implementable steps
Once you understand the problem, you need to decompose it into units of work that are able to be implemented in code. We ask that you solve this in an object-orientated manner as it will align most closely with how our customers operate. You are not being asked to implement or prove the mathematical efficiency of your solution.
1.3.3 Develop to be testable and verifiable
Your solution must be built to be testable. We recommended taking a TDD (Test Driven Development) approach however you are welcome to challenge that and propose an alternative. Not negotiable is that your code will be unit tested and have 100% code coverage. This document will provide actual, historical, German encrypted messages, their settings and the validated decrypt for final testing. These MUST be used as part of your unit testing. If you can't prove your code works through unit-testing then it doesn't work – NOT NEGOTIALBLE.
1.3.4 Be efficient
You are a graduate and you got this job because we saw raw talent and passion in you. It's now time to lose the ego and learn to operate in a professional environment. Regardless of how good you think you may be, you have a lot to learn. You aren't being graded on completion of this project at an arbitrary date. Your objective is to complete this project as fast as possible against the provided requirements and objects. Time is money in the commercial world. This means, if you are stuck, swallow our pride and ask for help. Your mentors want you to FAIL FAST, FAIL OFTEN and ask for help. This is the best way to learn and aligns with modern development practices.
1.3.5 Don't break the build
One of the golden rules in development is that you never commit code that will break the build for other developers. The reason being, is that a broken build blocks EVERYONE on a team. It is time consuming and expensive for a team to fix a broken build.
1.4 Requirements
You must use the following technologies during this project
- Latest version of Visual Studio available
- C#
- Latest version of the .Net framework available
- TFVC or GIT version control inside VSTS
- Microsoft Test Framework
- Estimation and task planning is to be done using VSTS
In additional to meeting the technical requirements, you must also meet demonstrate that you have:
- Planned your project and broken into task inside VSTS
- Documented your code including providing pseudo code for any complex functionality
1.5 Success Criteria
Aside from meeting the aforementioned objectives, your enigma machine must be able to decode the following message.
Message
DLWF FWEG JXUY PMDI UWGM EGXW AYB-
Reflector: Thin C
Wheel order: γ (Gamma) V I III
Ringstellung: CODE
Ring positions: 16 09 13 16
Plug pairs: AY BF DL GX HZ NS OC QT RJ VP
1.6 Alternate Challenge
If you feel this challenge isn't hard enough for you, the alternate option is to implement in software, the Bombe machine to crack enigma messages. Requirements and objectives remain unchanged. Your success criteria is to decrypt the following encrypted message.
Message
QMFK NJBB JLOS MGXC JKRH EVTG XBG-
No encryption settings are provided
2 Problem
The following details the setup and mechanical operation of an Enigma machine. Like dealing with a real world client, it may or may not provide sufficient, accurate or sufficient information for you to complete the project. If you feel further information or clarification is required, please either search for the details from the internet or directly ask your client - A.K.A your mentor.
2.1 Components
The following image shows the basic components of an enigma machine. They will be individually described in detail in subsequent sections.
Figure 2: Enigma Machine. credit : www.cryptomuseum.com
2.2 Basic Operation
An enigma machine was operated by a single individual and an optional radio operator to help. The individual would first setup the machine using a known configuration that was changed daily and kept in codebook.
Figure 3: Codebook page from October 1944
Once a machine was setup, the operator typed the message into the machine and recorded the result on the lampboard. Because the enigma machine uses a symmetrical algorithm, the same initial setup was used for encoding and decoding.
For each character that is pressed, the machine first increments one or more rotors. Once a new circuit is complete, the encoded/decoded character is illuminated on the lampboard. The following diagram demonstrates the complete circuit from Keyboard through plugboard, rotors, reflectors then back before illuminating a lamp on the lampboard.
Figure 4 : Physical connections in the Enigma machine
2.3 Keyboard
The keyboard on the enigma machine was a 26 character QWERTY layout. A key press would first increment the rotors, then complete the circuit and illuminate the encoded character on the lampboard.
Figure 5 : Enigma Keyboard
2.4 Plugboard (Steckerbrett)
The plugboard was a component that remapped up to 10 characters and was the second element during encoding/decoding. The characters where mapped by physically connecting plugs and wires from the inbound character to the outbound. A character and be used for a mapped pair only once. The plugboard was added to military Engima machines to provide and extra level of security to messages.
Figure 6 : Enigma Plugboard
2.5 Scrambler Unit
The scrambler unit was the major component of the enigma machine. It was made up of an entry wheel, 3 or 4 rotors and a reflector. The rotors and reflectors are able to be changed by the user. The use is also able to set the starting position of each rotor after installation. The choice of rotors, reflector and rotor position was defined by the codebook.
Figure 7 : Scrambler unit showing rotors and reflectors
Once a key was pressed on the keyboard, the scrambler incremented one or more of the rotor position to form a new connection path way. The path on a 3 rotor machine was as follows:
- ETW (Entry Wheel / Static Rotor
Related Skills
node-connect
340.2kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
84.1kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
340.2kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
commit-push-pr
84.1kCommit, push, and open a PR
