The mechanical code scrambling machines developed in Germany. Manufactured by Scherbius & Ritter in the 1920s, Enigma was used for diplomatic and commercial purposes and eventually by the Nazis in World War II. Japanese and Italian versions were also used. Some Enigma models printed the messages received on a paper ribbon.
The codes were broken by the Allies in various countries throughout the war, but the code breaking system developed in England by Alan Turing in 1940 was considered a monumental achievement (see below). See
Turing test.
The Enigma Machine
With each keystroke, the machine would light up the scrambled letter, and the scrambled code would be transmitted. The machine's key settings were generally changed daily, and the receiving stations had to use the same settings in their Enigma machines to decipher the code they received. (Image courtesy of Museo della Scienza e della Tecnologia "Leonardo da Vinci," CC BY-SA 4.0 via Wikimedia Commons.)
Alan Turing's Bombe
Alan Turing and Gordon Welchman invented the Bombe, which broke the codes of the German war machine faster than previous methods. This book was inspiration for the 2014 movie "The Imitation Game" with Benedict Cumberbatch and Keira Knightley.