This page contains a zip file with C++ source code which I believe to be a reasonably reprasentative model of the Turing Bombe which was used at Bletchley Park in WWII to find the settings for the German Enigma machine.
1999 update: The (latest version) simulator works successfully with several of the BP Test Menus published on the BP Mailing list by Phil Marks. The simulator has also been updated to improve its ability to have turnover positions configured into its menu and also to handle the BP 'Teleprinter' form of menu which appears to be the wartime 'standard' way of specifying menus.
Some of the test menus cause incorrect results with this simulator for reasons I havent yet had time to delve into. Nevertheless, the simulator was used successfully in 1998 to solve a real enigma message posted by Tony Sale to the BP Mailing List.
To use the model, you will need a C++ compiler for your machine with which to compile it. You can then run any arbitrary text through the model to attempt to find the settings. Here is a sample command line:-
bombe THERAININSPAINSTAYSMAINLYONTHEPLANE ZXRQNLEAWAGHZFRDNVCZRKDUXMPHRHGUWZL x.x.x.xx.x..x.xxt...x.x
This is taken from an E-Mail correspondence between Nik Shaylor and Tony Sale. The correct answer is Wheel order 321, Ringstellung 'AAA', Start position 'AAA', Steckers AB CD EF GH IJ
To download the source code click here
This application is known to compile with Microsoft Visual C++ 5.0 Earlier versions were compiled with V4.2. Settings are as follows:-
Macros - NDEBUG,WIN32,_CONSOLE,NOMINMAX,_AFXDLL,_MBCS
Code generation - multithreaded DLL RTL
Optimise for maximised speed
STL Containers are used in several places. If your compiler does not support STL, you will need to find another collection class to use.
This file can be compiled in several configurations by changing the #define lines. The following are known to work:-
DIAGONAL_BOARD - Turing Bombe, Diagonal Board, No shortcuts
DIAGONAL_BOARD,TURING_SHORTCUT - as above, Turing shortcut (approx 26 times
faster than without shortcut). This involves checking for 1 or 25 steckers
implied by an input hypothesis.
DIAGONAL_BOARD,CARLSON_SHORTCUT - 5 times faster (in software) than Turing
Shortcut. This is a shortcut which is only helpful in software implementations.
It involves rejecting a hypothesis as soon as a single stecker conflict is
detected.
Menus are configured automatically. The user supplies the plain and cyphertext as command line arguments, together with an optional mask indicating which character positions are to be included in the menu. Use 'x' to include a character, anything else (e.g. '.' to exclude). If no mask is supplied, the first 12 characters will be used.
The character 't' in the mask is used to indicate the first character in the menu after an assumed turnover position.
The Model can also use the Bletchley Park 'teleprinter' form for setting up menus. In this form a series of 4 letter groups are supplied, the first two indicating plain and cypher letters and the next two the offset in the menu. The first turnover is between offsets ZZ/AA, the next between AZ/BA etc.
To use the 'teleprinter' form, specify the four letter groups (with spaces between them) as command line parameters (there must be more than 3 groups)
Optional Arguments are as follows:-
-bp - Use Bletchley Park Bombe wheel configuration (default is to use the
German configuration, which is easier to test on the Enigma Simulator)
-daw - Dump all wheel indicators for each stop (default is to dump just the
first set of indicators)
-woNNN - Process wheel order NNN only
-woxNNN - Exclude any wheel order containing ANY of wheels NNN in the
corresponding positions e.g. -wox123 would exclude 154, 524, 543
but not 514 etc.
Some timings on a 166MHz Pentium MMX with 80Mb RAM under NT 4.0:-
CT: ZXRQNLEAWAGHZFRDNVCZRKDUXMPHRHGUWZL
PT: THERAININSPAINSTAYSMAINLYONTHEPLANE
MASK: x...x..x.x..x.xxx...x.x
For wheel order 321 only:-
Diagonal Board, no shortcuts:-
AAA AB CD IJ NN RR SS TT ZZ
258528355 chars in 913 seconds
Turing Shortcut:-
AAA AB CD IJ NN RR SS TT ZZ
9938575 chars in 34 seconds
Carlson Shortcut:-
AAA AB CD IJ NN RR SS TT ZZ
1608085 chars in 6 seconds
For all orders of 5 wheels (60 orders):-
Turing Shortcut:-
596695340 chars in 2104 seconds
55 stops
Carlson Shortcut:-
96399748 chars in 393 seconds
55 stops
With a better menu...
CT: ZXRQNLEAWAGHZFRDNVCZRKDUXMPHRHGUWZL
PT: THERAININSPAINSTAYSMAINLYONTHEPLANE
MASK: x.x.x.xx.x..x.xxx...x.x
...
Testing 3 2 1
AAA AB CD EF IJ NN RR SS TT ZZ
...
107027861 chars in 460 seconds
1 stop
John Harper's Turing Bombe Pages and the Bombe Rebuild Project
Nik Shaylor's C++ and Java Simulations and a description of how the Bombe worked.
Back to 'About Enigma and its Decryption' - Back to Enigma Applet