15 June, 2022

Ciphers 101 - crack the Enigma

A few weekends ago I visited Bletchley Park (BP) in Bucks UK. BP was the headquarters of the British codebreaking operation in World War 2, made famous after the war for their work cracking the German Enigma cipher system. While little remains of the top secret operation (aside from the wooden huts built in the grounds of the house) I was inspired to learn some basic cryptography, replicate the Enigma machine in Python and provide it in Jupyter notebook form to allow others to have a go at breaking it (with the help of a modern computer).

This notebook documents my journey over the past few weeks learning about basic ciphers, how they relate to modern algorithms and how the Enigma worked. It's not totally linear and a bit rough but hopefully it'll be interesting for someone else.

N.B. I am not a mathematician, much less a cryptographer. I wrote this as I find it useful to refresh my probability skills and practice writing but you probably shouldn't rely on any of the information in here. Create a pull request on the repo if you'd like to fix a mistake, suggest a change or make an improvement and I'll do my best to merge it in.

Click here for the Google Colab notebook.

Click here for the source code and to make a contribution.

© 2023 Henry Course