Updated September 9, 2009
After I added an M-209-B Converter to my collection, I decided to write a software simulation of it as a learning exercise. Here is the result: a command-line application, written in C++, which is able to encipher and decipher text just like a real M-209 machine does. In addition, my simulator can generate new random keys and automate parts of the message-handling process. I'm releasing my simulator under the GNU Public License in the hope that it may be useful, educational and/or entertaining.
My simulator is not the only one out there. I suggest that you also look at this wonderful graphical M-209 Simulator written by Dirk Rijmenants!
I've named my simulator package "hagelin", with the expectation that I will eventually add simulators for more of Boris Hagelin's pin-and-lug cipher machine designs. For now, only an M-209 simulator is included in the "suite". If and when I add more simulators to the package, you'll still find it at this URL, though the title of this page would then change.
The hagelin package is distributed as source code. To build it, you'll need a fairly recent Unix-like system, a C++ compiler (such as g++), and other common development tools which you probably have if you have the C++ compiler. It may be possible to port the hagelin package to other systems on which a C++ compiler is available.
The hagelin package has been successfully built on the following systems:
The Mac environment listed above is my primary development environment for the hagelin project.
It should be possible to build the hagelin project without much trouble on any fairly recent Unix-like system on which the GNU toolchain is available and on which common GNU software packages are easily built.
Here is the latest version of the hagelin source code package:
| hagelin-1.2.tar.bz2 |
You compile and install the hagelin package just like most common open-source packages on Unix-like systems:
tar xjvf hagelin-1.2.tar.bz2
cd hagelin-1.2
./configure
make
make check
make install
Please refer to the manual page(s) installed as part of the hagelin package, as well as the built-in help that's available by calling any of the included programs with the "-h" option. For your convenience, here are PDF versions of the included manual pages:
Here is an operation example:
~...hagelin-1.2/samples% ls
MB.m209key cipher.txt deciphered.txt plain.txt
~...hagelin-1.2/samples% m209 -g -p -l AB > AB.m209key
~...hagelin-1.2/samples% ls
AB.m209key MB.m209key cipher.txt deciphered.txt plain.txt
~...hagelin-1.2/samples% cat plain.txt
old password compromised new password is quote
aaaaargh dont shoot dont shoot unquote
~...hagelin-1.2/samples% m209 -a -c -l AB < plain.txt > mycipher.txt
Reading from stdin...
Loading key file ./AB.m209key
~...hagelin-1.2/samples% cat mycipher.txt
UUMEP IKHAB LWRUK ZHYXT GRMVL
PPNGD UWSRN IBDMI TWIVT YZYNV
VZYVU XQKYV NPJLD BUHTA YBGMV
ZHLKO VPVGC HTLFM APMLO UUMEP
IKHAB
~...hagelin-1.2/samples% m209 -a -d < mycipher.txt
Reading from stdin...
Loading key file ./AB.m209key
OLD PASSWORD COMPROMISED NEW PASSWORD IS QUOTE AAAAARGH DONT SHOOT DONT SHOOT UNQUOTE
If you find any bugs, please let me know.