A Stick Figure Guide to the Advanced Encryption Standard (AES)
(A play in 4 acts. Please feel free to exit along with the stage character that best represents you. Take intermissions as you see fit. Click on the stage if you have a hard time seeing it. If you get bored, you can jump to the code. Most importantly, enjoy the show!)
Act 1: Once Upon a Time…
Act 2: Crypto Basics
Act 3: Details
Act 4: Math!
Epilogue
I created a heavily-commented AES/Rijndael implementation to go along with this post and put it on GitHub. In keeping with the Foot-Shooting Prevention Agreement, it shouldn’t be used for production code, but it should be helpful in seeing exactly where all the numbers came from in this play. Several resources were useful in creating this:
- The Design of Rijndael is the book on the subject, written by the Rijndael creators. It was helpful in understanding specifics, especially the math (although some parts were beyond me). It’s also where I got the math notation and graphical representation in the left and right corners of the scenes describing the layers (SubBytes, ShiftRows, MixColumns, and AddRoundKey).
- The FIPS-197 specification formally defines AES and provides a good overview.
- The Puzzle Palace, especially chapter 9, was helpful while creating Act 1. For more on how the NSA modified DES, see this.
- More on Intel’s (and now AMD) inclusion of native AES instructions can be found here and in detail here. - Other helpful resources include Wikipedia, Sam Trenholme’s AES math series, and this animation.
Please leave a comment if you notice something that can be better explained.
Update #1: Several scenes were updated to fix some errors mentioned in the comments.
Update #2: By request, I’ve created a slide show presentation of this play in both PowerPoint and PDF formats. I’ve licensed them under the Creative Commons Attribution License so that you can use them as you see fit. If you’re teaching a class, consider giving extra credit to any student giving a worthy interpretive dance rendition in accordance with the Foot-Shooting Prevention Agreement.