Dec 272017
Software simulation of WWII German code cipher machine.
File ENIGMA.ZIP from The Programmer’s Corner in
Category Science and Education
Software simulation of WWII German code cipher machine.
File Name File Size Zip Size Zip Type
ENIGMA_2.DOC 9600 3955 deflated
ENIGMA_2.EXE 31744 19922 deflated

Download File ENIGMA.ZIP Here

Contents of the ENIGMA_2.DOC file

WWII German Cryptograph

Enigma, Ultra, cyclometer, bombas, bombes, Bletchley, Banbury,
Turing, .., .., . The list of names associated with the solution of
the code is endless. There is certainly no intent to slight here
the effort of any nation(s) or individual(s) by omitting them from
this list. Indeed, there is equally no intention of extending this
paper into the area, where angels fear to tread, of the several
controversies which have arisen, as they always do around legends.
Rather, the intent of this paper, and indeed this library of files,
will be to present, on a very small scale, the Enigma as a device,
and the technical factors involved in interceptions.

A few of those points WILL be simply mentioned now, to put the
entire issue in perspective, by associating the legends.
1) The question of which nation took what part, at which stage,
and under what constraints, in the monumental effort.
2) The relative impact of the project on the conduct or outcome
of World War II, from "winning the war" to "incidental".
3) The often repeated, but unsubstantiated, questions surround-
ing the bombing of Coventry in 1940.

Actually, one controversy may be of interest in computer terms.
It has been reported that Great Britain, which in 1943 developed
the "world's first electronic computer" (referring, of course, to
COLOSSUS, though even that title is disputable), did so as an
outgrowth of the earlier (electromechanical) bombas and bombes, and
applied it to the solution of Enigma traffic. This report has been
questioned, on the grounds that the COLOSSI were used to attack the
German Geheimschreibers (secret writers), more complex than the

The origin during the 1920's, of the Engima as we know it was as
a commercial device, sold to German industrial and business users,
and indeed in the 1930's to other nationalities as well. Poland
first became aware of the device about 1927, through a weekend
incident in Polish Customs involving a shipment made in error to a
German firm in Poland. Later, Poland openly purchased one from the
German manufacturer. The effort more often attributed to the Poles
was the capturing of a military version by the underground early
in the war. In any event, several European nations, including
Great Britain, Poland, and France were involved during the 1930's
in deciphering messages using the Engima, with little cooperation,
yet with considerable success. Indeed, an early, non-plugboard
version was used in the Spanish Civil War. Of course, the military
version differed in some respects, notably that the reflecting drum
was immovable in it, but the point here is that the Enigma concept
had been studied by the Allies long before 1939, the war's opening.

Physically, the external case of the original device resembled a
portable typewriter, though the ratio of the length of its sides
differed, being long and narrow. It contained a 26-letter keyboard
with (flashlight-like) lamps in place of the typebars, a plug-type
switchboard (which actually exchanged letter pairs), a battery for
power, and, finally, its most important part, a shaft holding three
drums (rotors), together with a fourth "reflecting" drum. On each
drum was a ring, on which were engraved the 26 letters of the
alphabet, and which could be rotated with respect to the rest of
the drum. The center of each drum was an insulating disk, with 26
stationary contacts on one side connected irregularly to 26 spring
contacts on the other side. The drums had toothed gears, to allow
relative turning of one by the next one.

When a key was pressed, the rightmost drum rotated 1/26th of
its circumference, and current flowed through the key, through the
three drums to the reflecting drum, then back again through the
three drums, through the plugboard, to light the proper lamp for
the enciphered letter. As encipherment continued, each successive
drum in turn rotated according to a plan much like an odometer.
Actually, in certain positions, the second drum might rotate two
positions for one complete rotation of the previous one, unlike an

As this description indicates, a number of factors influenced
encipherment :
1) the connections of the drums, a factor of manufacture,
2) the daily key, including the setting of the rings, the order
of the drums on the shaft, the plugboard settings, and others,
3) the message key, the name applied to the initial setting of
the drums, with which the current message began.
It should be noted that, in early usage, the daily key was changed
on a somewhat extended schedule (perhaps once each month for some).
As the war progressed, they were changed with increasing frequency,
until finally, it became apparent that the Germans suspected their
traffic was being handled with some degree of success. As the war
ended, a new cipher machine was being introduced on the line.

Clearly, the intent of such a device relies less on the device
itself than on the management of its several factors. The Germans
decided that each military message originator would randomly set
his own message key, transmitting it in three enciphered characters
at the beginning of each message. Because of the unreliability of
military communications at that stage, they were transmitted twice
in succession. Thus, the first six characters of each message were
the message key, i.e. the initial settings of the drums.

To illustrate the complexity of the problem, the number of
possible unique interconnection sets of enciphering drums is 26!,
or 403,291,461,126,605,635,584,000,000 , and the number of unique
reflecting drum connections is 7,905,853,580,025. However, from a
practical point of view, all military machines would have the same
set of connections, to insure universal military communications.
This, then, is the importance of capturing a military unit, without
the enemy's certain knowledge. Clearly, the replacement of ALL
military units (estimated at 100,000 to 200,000) during the war,
would be a monumental logistic task, to be avoided unless totally

Yet, even the keys presented no small problem. Each enciphering
drum can be set 26 different ways. Even with only three drums,
this means 17,576 possibilities. And, since their order on the
shaft can be changed, the combination of the two yields 105,456
possibilities. Add to this the plugboard variations (the original
6 pairs of letters was later increased to 10 pairs, leaving only 6
self-steckers of the 26 letters), and the problem increases. Then,
note that, as early as 1939, some parts of the German military used
a selection of eight drums from which to draw their three, and the
U-boats later used a 4-drum device. Each of these geometrically
increased complexity.

The task at hand was statistically a gigantic one, but one which
could be solved with sufficient resources, both mechanical and
human. These were applied during the war in a number of locations,
mostly in England ... from Alan Turing's organisation, with its
statisticians and other specialists to "the girls" of Banbury, as
they were known, the scores of young women who daily prepared the
"Banbury sheets". These were laboriously punched forms of daily
message traffic, from which repeat patterns were derived, using
"weights of evidence". And, as history knows, it WAS solved, to
the great benefit of the Allied war effort.

I sincerely hope that this writing, though perhaps too simple for
those with an interest in cryptoanalysis, has provided you with
some knowledge of the nature of the Engima, and the project which
the British called Ultra.

The program included in this library illustrates the techniques
described here. There are a number of papers and books on the
subject for those who wish to pursue it, including the one from
which part of this material was drawn. That article, which itself
contains some bibliography, appeared in the Annals of the History
of Computing, Vol 3, # 3, copyright July 1981, AFIPS (American
Federation of Information Processing Societies) . Permission to
excerpt was granted on condition that it not be used for direct
commercial advantage, and notice of copyright be included, as it is
here. Therefore, the several files of this library must not be
separated, and this notice must be left intact.

J. E. Eller 536 Caren Dr Va.Beach,VA 23452 (804)340-3848

 December 27, 2017  Add comments

Leave a Reply