Jupyter Notebook Python Shell
Switch branches/tags
Nothing to show
Clone or download
Latest commit ad8926a Aug 29, 2017


crypto-rnn: Learning the Enigma with Recurrent Neural Networks

See paper and blog post



This repo contains a deep LSTM-based model for learning polyalphabetic ciphers. It also contains code for training the model on three ciphers: the Vigenere, Autokey, and Enigma ciphers. The first two are light proof-of-concept tasks whereas the Enigma is much more complex. For this reason, the Enigma model is enormous (3000 hidden units) and takes a lot longer to train.

Vigenere and Autokey ciphers

The Vigenere cipher works like this (where we're encrypting plaintext "CALCUL" with keyword "MATHS" (repeated)). The Autokey cipher is a slightly more secure variant. Vigenere cipher

Enigma cipher

The Enigma cipher works like this. Enigma cipher


  • All code is written in Python 3.6 and TensorFlow 1.1. You will need:
  • NumPy
  • TensorFlow