The Enigma machine was a mechanical device used for encoding and decoding secret messages. During WWII, the Enigma machine was used by the German military to communicate with troops in the field, warships, and submarines. Allied cryptologists, working under the codename ULTRA, successfully cracked most of the Enigma ciphers; this gave the Allies an important source of intelligence for the war effort.
The Enigma machine itself was mechanical, and looked much like a typewriter. Every time a key was pressed, the electronic signal would pass through a series of rotatable scrambling wheels, through a plugboard, and then back out in a different direction. Because each wheel could be turned to alter the signal's path, a huge variety of different keys was possible, and the wheels could simply be rotated every time a new key was needed. The wheels were arranged to rotate every time a key was pressed, making Enigma secure against letter-frequency attacks; the starting positions of the wheels were also changed, often several times a day.
In theory, Enigma was supposed to be secure against any type of brute-force attack, as there were far too many cipher possibilities to try them all one-by-one. Later versions of Enigma, such as the four-rotor models used by German U-boats, increased the number of combinations even further. Even so, captured code documents and human error often gave the cryptographers the upper hand, and the Polish military was decoding secret German communications as early as 1932. Their work eventually made it over to Britain and America, and the codebreaking continued with a great deal of success throughout the war, despite the attempts of the Germans to make the machine more and more complex.
Successfully breaking the Enigma code required finding regularities, or known factors, to reduce the huge number of possible ciphers. Several simple texts, such as “Heil Hitler,” frequently appeared in German messages; this gave important clues to cryptanalysts, who could search through an encrypted message and see where such a phrase might appear. The Germans also transmitted simple, easy-to-analyze six-letter headers at the beginnings of messages, such as “EINEIN”, to give the location of the cipher wheels for the rest of the message. When the space of possible code keys still became too large, several primitive computers were constructed, to count through the thousands of possibilities automatically; this became some of the first work done into general purpose computing.