On this page, we'll go into more detail on some of the workings within the M-209 to hopefully help you understand how this machine worked.
The cipher mechanism on this machine comprises of two main parts: the pin-wheels at the front and the lugs mounted on the 27 bars of the rotating drum at the rear.
Each key wheel contains a different number of letters, and a correspondingly different number of pins. From left to right, the wheels have:
Each of the pins can be pushed through to either the left (inactive) side or the right (active) side using the tool mounted in the lid.
There are two lugs mounted on each of the 27 bars in the drum. These can be moved to any of 6 active positions or to one of the inactive positions (marked as 0). The lugs slot into small holes along the bar, so moving them requires them to be pushed away from the bar which allows them to slide to a new position.
Highlighed here are two of the lugs: the first set at position 3 and the second at position 6.
Below is a video showing how the pins and lugs all work together to move a pseudo-random number of bars across on the drum. As the drum turns one full turn, the pushed out bars act like a changable tooth gear which can have the number of teeth on it altered from 0 to 27 possible teeth.
This changable gear meshes with a small gear which in turn rotates the setting knob with the letters on the same pseudo-random number of steps each turn, all dependant on how many pins are active and how many of the lugs and bars interact with them. The drum also moves an axle which is attached to each of the pin-wheels, moving each of them one step on for each letter enciphered. This changes which pins are now interacting with the arms and therefore, changes the number of teeth set on the next letter.
The video below is from a work-in-progress report as I was making this simulation which shows the full cycle of the mechanism working to turn the print wheel.
When enciphering a message, the Hagelin M-209 automatically spaces the text into 5 letter groups with a space between them. How it does this is an amazing piece of engineering, remember, this doesn't have any electronic components to do this, it's entirely mechanical!
How does the Hagelin M-209 print on the paper tape? It's another neat piece of engineering and uses another cam and lever attached to the end of the drum as it rotates. The easiest way to show how the printer works, is by watching this explanatory video below
You may think that the cipher-decipher knob (marked C/D) actually changes how the machine enciphers the letters, but actually, it doesn't affect the way the machine enciphers at all!
What it actually does is change the printer grouping function and how the Z character is printed. When in cipher mode, the Z character is printed as normal and the printed letters are all grouped together in groups of 5. When in decipher mode, the Z character is used as a space and the letters are all printed without grouping.
This is achieved as explained in the following video:
This project to recreate a Virtual Hagelin M-209 began when I found that the Deutsches Museum had run a project where they had created and released several CT scans of some of their collection of cipher machines. This impressive project is documented here where you can view and download their 3D CT scans https://digital.deutsches-museum.de/en/projects/3d-cipher/
A Hagelin machine had always been on my wish-list of cipher machines to simulate, and this gave the possibility of bringing an unprecedented level of detail to the models, allowing very accurate sizing of all of the components and a complete understanding of how the machine functions.
The next step was to create a 3D mesh model from the stack of sliced 3D images which could be loaded into Blender (https://www.blender.org/), a Free and Open Source 3D design studio. This step was greatly assisted by Matthias Göggerle who was part of the team at the Deutsches Museum's 3D scan project.
Each component of the basic model is the loaded and rendered in the browser using an amazing WebGL rendering library called three.js (three.js) with the movement and animations all done in JavaScript