Polyalphabetic cyphers have been used for centuries and well into the 1970s to transmit all kinds of messages. Since then, computers and modern cryptography have taken over making bruteforce attacks unfeasible when designed properly. However, there was a time where mechanical machines, built to operate in harsh conditions and sometimes even without power, were the state of the art for keeping secrets secret. During World War II both Axis and Allied powers used different machines to ensure their dominance. To communicate with occupied territories, Germany installed the Siemens & Halske T52, also known as Geheimschreiber (the secret teleprinter), on telex lines running through Sweden. On the allied side, the United States of America adopted the Hagelin C-38 (known as the M-209) of Swedish invention for field operation. While both machines are inherently different as to what tasks they perform and how, they can both be considered complex polyalphabetic cyphers. Many different methods and attacks on these kind of cyphers have been developed, some relying on inner knowledge and some on mechanical devices. However, the application of Machine Learning to extract key information from intercepts is not a well researched area yet. This thesis aims to demonstrate the potential of LSTM networks on known plaintext attacks against different classical as well as stream cyphers. The techniques used have proven to be effective on the Vigenère as well as with the Hagelin C-38 while being partially successful on the Geheimschreiber with crib lengths of only 15 characters.
Historically, rotor cyphers have been used in order to secure written communications. Mechanical machines provided continuous streams of characters for encoding secret messages that were sent to the other part of the continent by means of telephone cables or radio. Several people tried in vain to tackle them but only those bold enough were successful. In Sweden, the Siemensand Halske T52 was used by the Germans during World War II and Arne Beurling was one of those bright people that successfully broke it. This thesis aims to recreate his steps applying modern concepts to the task, breaking the Geheimschreiber. In order to do that, a recreation of the machine has virtually been built and several German texts encyphered. The techniques used, involving Recurrent Neural Networks, have proven to be effective in breaking all XOR wheels with different crib sizes removing the random factor introduced by the cypher. However, if this method can be applied to real war intercepts remains to be seen.