Stick Guide

User Manual: Pdf

Open the PDF directly: View PDF PDF.
Page Count: 45

1/20/2018 A Stick Figure Guide to the Advanced Encryption Standard (AES)
http://www.moserware.com/2009/09/stick-figure-guide-to-advanced.html 1/45
A Stick Figure Guide to the Advanced
Encryption Standard (AES)
Sep 22, 2009
(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…
Moserware About
1/20/2018 A Stick Figure Guide to the Advanced Encryption Standard (AES)
http://www.moserware.com/2009/09/stick-figure-guide-to-advanced.html 2/45
1/20/2018 A Stick Figure Guide to the Advanced Encryption Standard (AES)
http://www.moserware.com/2009/09/stick-figure-guide-to-advanced.html 3/45
1/20/2018 A Stick Figure Guide to the Advanced Encryption Standard (AES)
http://www.moserware.com/2009/09/stick-figure-guide-to-advanced.html 4/45
1/20/2018 A Stick Figure Guide to the Advanced Encryption Standard (AES)
http://www.moserware.com/2009/09/stick-figure-guide-to-advanced.html 5/45
1/20/2018 A Stick Figure Guide to the Advanced Encryption Standard (AES)
http://www.moserware.com/2009/09/stick-figure-guide-to-advanced.html 6/45
1/20/2018 A Stick Figure Guide to the Advanced Encryption Standard (AES)
http://www.moserware.com/2009/09/stick-figure-guide-to-advanced.html 7/45
1/20/2018 A Stick Figure Guide to the Advanced Encryption Standard (AES)
http://www.moserware.com/2009/09/stick-figure-guide-to-advanced.html 8/45
1/20/2018 A Stick Figure Guide to the Advanced Encryption Standard (AES)
http://www.moserware.com/2009/09/stick-figure-guide-to-advanced.html 9/45
1/20/2018 A Stick Figure Guide to the Advanced Encryption Standard (AES)
http://www.moserware.com/2009/09/stick-figure-guide-to-advanced.html 10/45
1/20/2018 A Stick Figure Guide to the Advanced Encryption Standard (AES)
http://www.moserware.com/2009/09/stick-figure-guide-to-advanced.html 11/45
Act 2: Crypto Basics
1/20/2018 A Stick Figure Guide to the Advanced Encryption Standard (AES)
http://www.moserware.com/2009/09/stick-figure-guide-to-advanced.html 12/45
1/20/2018 A Stick Figure Guide to the Advanced Encryption Standard (AES)
http://www.moserware.com/2009/09/stick-figure-guide-to-advanced.html 13/45
1/20/2018 A Stick Figure Guide to the Advanced Encryption Standard (AES)
http://www.moserware.com/2009/09/stick-figure-guide-to-advanced.html 14/45
Act 3: Details
1/20/2018 A Stick Figure Guide to the Advanced Encryption Standard (AES)
http://www.moserware.com/2009/09/stick-figure-guide-to-advanced.html 15/45
1/20/2018 A Stick Figure Guide to the Advanced Encryption Standard (AES)
http://www.moserware.com/2009/09/stick-figure-guide-to-advanced.html 16/45
1/20/2018 A Stick Figure Guide to the Advanced Encryption Standard (AES)
http://www.moserware.com/2009/09/stick-figure-guide-to-advanced.html 17/45
1/20/2018 A Stick Figure Guide to the Advanced Encryption Standard (AES)
http://www.moserware.com/2009/09/stick-figure-guide-to-advanced.html 18/45
1/20/2018 A Stick Figure Guide to the Advanced Encryption Standard (AES)
http://www.moserware.com/2009/09/stick-figure-guide-to-advanced.html 19/45
1/20/2018 A Stick Figure Guide to the Advanced Encryption Standard (AES)
http://www.moserware.com/2009/09/stick-figure-guide-to-advanced.html 20/45
1/20/2018 A Stick Figure Guide to the Advanced Encryption Standard (AES)
http://www.moserware.com/2009/09/stick-figure-guide-to-advanced.html 21/45
1/20/2018 A Stick Figure Guide to the Advanced Encryption Standard (AES)
http://www.moserware.com/2009/09/stick-figure-guide-to-advanced.html 22/45
1/20/2018 A Stick Figure Guide to the Advanced Encryption Standard (AES)
http://www.moserware.com/2009/09/stick-figure-guide-to-advanced.html 23/45
1/20/2018 A Stick Figure Guide to the Advanced Encryption Standard (AES)
http://www.moserware.com/2009/09/stick-figure-guide-to-advanced.html 24/45
1/20/2018 A Stick Figure Guide to the Advanced Encryption Standard (AES)
http://www.moserware.com/2009/09/stick-figure-guide-to-advanced.html 25/45
1/20/2018 A Stick Figure Guide to the Advanced Encryption Standard (AES)
http://www.moserware.com/2009/09/stick-figure-guide-to-advanced.html 26/45
1/20/2018 A Stick Figure Guide to the Advanced Encryption Standard (AES)
http://www.moserware.com/2009/09/stick-figure-guide-to-advanced.html 27/45
Act 4: Math!
1/20/2018 A Stick Figure Guide to the Advanced Encryption Standard (AES)
http://www.moserware.com/2009/09/stick-figure-guide-to-advanced.html 28/45
1/20/2018 A Stick Figure Guide to the Advanced Encryption Standard (AES)
http://www.moserware.com/2009/09/stick-figure-guide-to-advanced.html 29/45
1/20/2018 A Stick Figure Guide to the Advanced Encryption Standard (AES)
http://www.moserware.com/2009/09/stick-figure-guide-to-advanced.html 30/45
1/20/2018 A Stick Figure Guide to the Advanced Encryption Standard (AES)
http://www.moserware.com/2009/09/stick-figure-guide-to-advanced.html 31/45
1/20/2018 A Stick Figure Guide to the Advanced Encryption Standard (AES)
http://www.moserware.com/2009/09/stick-figure-guide-to-advanced.html 32/45
1/20/2018 A Stick Figure Guide to the Advanced Encryption Standard (AES)
http://www.moserware.com/2009/09/stick-figure-guide-to-advanced.html 33/45
1/20/2018 A Stick Figure Guide to the Advanced Encryption Standard (AES)
http://www.moserware.com/2009/09/stick-figure-guide-to-advanced.html 34/45
1/20/2018 A Stick Figure Guide to the Advanced Encryption Standard (AES)
http://www.moserware.com/2009/09/stick-figure-guide-to-advanced.html 35/45
1/20/2018 A Stick Figure Guide to the Advanced Encryption Standard (AES)
http://www.moserware.com/2009/09/stick-figure-guide-to-advanced.html 36/45
1/20/2018 A Stick Figure Guide to the Advanced Encryption Standard (AES)
http://www.moserware.com/2009/09/stick-figure-guide-to-advanced.html 37/45
1/20/2018 A Stick Figure Guide to the Advanced Encryption Standard (AES)
http://www.moserware.com/2009/09/stick-figure-guide-to-advanced.html 38/45
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.
1/20/2018 A Stick Figure Guide to the Advanced Encryption Standard (AES)
http://www.moserware.com/2009/09/stick-figure-guide-to-advanced.html 39/45
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.
251 Comments Moserware
Login
1
Share
Sort by Best
LOG IN WITH OR SIGN UP WITH DISQUS
Join the discussion…
?
Reply
Chandan Jha 3 months ago
Wow! That was an awesome explanation. Thanks for the PPT and PDF... Good contribution...
Cheers!
PS: couldn't manage with the Maths part but still went through it. ;-) need to improve my
maths skills.
6
Reply
Anonymous 8 years ago
Should be be in the preface of CS cryptography textbooks! Terrific
4
Reply
Adam M. Erickson 4 years ago
This should be in CS and ISM textbooks. A+ Moser.
1
Reply
James McCune 14 days ago
Awesome content man!
Really helped me out
Reply
Leonard Michael Hurlocker 2 months ago
Love it! Thx.
Recommend
43
Share ›
Share ›
Share ›
Share ›
Share ›
1/20/2018 A Stick Figure Guide to the Advanced Encryption Standard (AES)
http://www.moserware.com/2009/09/stick-figure-guide-to-advanced.html 40/45
Reply
Reply
Hope Ordu 3 months ago
Lovely explanation. Couldn't have understood any better
Reply
Matthew Ewer 5 months ago
In the big chart, bottom right, in the bottom right of the Inverse Mix table, I think that B
should be an E.
Reply
Lightning342 5 months ago
Great epilogue, I especially liked the math parts that visualize the operations. Just one issue;
in both encryption and decryption the last round is always the one with three steps (without
mixcolumns). Check the pseudo code in NIST.FIPS.197 (figure 5 & 12), or search the Internet
for images on "simplified aes decrypt" . So aes_act_3_scene_20_decrypting_1100 is
incorrect.
Reply
Sleem A. Lama 6 months ago
This is awesome.. Thank you
Reply
ATA UR REHMAN 10 months ago
Seriously One great article.. Loved it (Y)
Reply
Rami Stefanidis a year ago
Very cool article. Thank you
Reply
Gidz Paul a year ago
Awesome.. :o
Reply
Walter Zambotti a year ago
Very nice. Did I miss where in the presentation you display the final encrypted text???
Reply
netdeamon 2 years ago
Cool !!! Keep it up!
Reply
Felipe S Mattos 2 years ago
this is rocksome! very nice work!
Share
Share ›
Share ›
Share ›
Share ›
Share ›
Share ›
Share ›
Share ›
Share ›
Share ›
1/20/2018 A Stick Figure Guide to the Advanced Encryption Standard (AES)
http://www.moserware.com/2009/09/stick-figure-guide-to-advanced.html 41/45
Reply
Reply
assignment writing 2 years ago
It's actually a good work that you have shared which covers up some topics about that kind
of subject that was being tackled in school for those students who studies in the field of
engineering. Through this, they can learn something that they will going to use as their guide.
Reply
Benjamin Barenblat 3 years ago
A minor error in act 3, scene 11: entry a₀₁ of the right block should read ‘fb’, not ‘f8’. (This
has already been corrected in scenes 12 and 13.)
Reply
Kevin 4 years ago
Thanks man!! :)
Reply
Raymond Starkey 4 years ago
Talent, talent, talent, talent. Art - must try harder.
Reply
Theuns Alberts 4 years ago
Brilliantly explained! And thanks for the effort with the accompanied code.
Reply
Todd 4 years ago
Awesome. But where is the part where the NSA builds in a back door to circumvent all the
cryptology?
Reply
Anonymous 4 years ago
was fun........gr8.......learning it and signng the letter....
Anonymous 5 years ago
Can't figure out if ALL these have any relation at all with this one:
"The key to this encryption rule is given by two numbers n and r. The number n is chosen in
a very particular way: n is the product of two primes p and q. where n is the product of two
primes p and q. To encrypt x we just compute: y = x^r(mod n).
The decryption then works via a simple formula, analogous to the encryption: we compute
y^s(mod n).
Suppose we choose n = p * q = 29 * 37 = 1073. Let's take r = 25 with this choice of n and r,
the choice s = 121 is an appropriate decryption key...
The decryption illustrated on the previous page is possible because r and s have a very
special relationship. With p = 29, and q = 37, we compute:
Share ›
Share ›
Share ›
Share ›
Share ›
Share ›
Share ›
Share ›
1/20/2018 A Stick Figure Guide to the Advanced Encryption Standard (AES)
http://www.moserware.com/2009/09/stick-figure-guide-to-advanced.html 42/45
Reply
special relationship. With p 29, and q 37, we compute:
m = (p-1) * (q-1) = 1008 and then we have chosen r and s so that:
r*s = 25 * 121 = 3025 = 1 (mod m)..."
Link: http://web.math.princeton.e...
Reply
otis root a year ago
> Anonymous
That is RSA
Reply
Cường Đặng Đình 5 years ago
thanks very much!!!!!!!!!
Reply
Trung Le 5 years ago
That was a really good work you have done! Helped me a ton to understand AES in a visual
way. Keep it up!
Reply
KF 5 years ago
Thank you for your awesome job... really let me understand much. This is fun too. Appreciate
it very much.
Reply
Jeff Moser 5 years ago
Thanks everyone for the kind feedback!
Anonymous: For details about being resistant to cryptanalysis, I recommend reading the
book but it's quite a bit more complicated than this comic. Perhaps try the Wikipedia page.
Regarding modes, Wikipedia's page on it is pretty good.
Reply
Charulatha Jain 5 years ago
Its an awesome presentation and quite helpful for beginners to understand the concepts.
Thank you for the awesome presentation.
Reply
Anonymous 5 years ago
This is one of the most superb explanations of AES I've ever seen. So easy to understand,
it's brilliant. But I'd love to know more about the resistance to cryptanalysis, I understand
what it is but I have no idea how AES resists it. Plus I'd like to know more about the various
"modes" you touched on!
In summary: encore!
Share ›
Share ›
Share ›
Share ›
Share ›
Share ›
Share ›
Share ›
1/20/2018 A Stick Figure Guide to the Advanced Encryption Standard (AES)
http://www.moserware.com/2009/09/stick-figure-guide-to-advanced.html 43/45
Reply
durdave 5 years ago
Great! But I'm still left with the question "Will Ashley go out with me?" Maybe if I get a
Ferrari?
Reply
Anonymous 5 years ago
Superb. Keep it up Brother.
Reply
Anonymous 5 years ago
Amazing would be an understatement!
Reply
naveregnide 6 years ago
Hey! Just stopping by to say that this lovely comic really helped me understand AES a lot
more. Such a great sense of humour used in it too! Thanks!
Reply
Jeff Moser 6 years ago
Thanks everyone for the kind feedback over the years.
Special thanks to txipxi for the Spanish translation.
Vincent: For details on how all S-Box values are calculated, follow along with the S-Box
demonstration section my example program and the f(x) and g(x) section as well. For even
more details, see how I implemented f and g. Note specifically how "f" is a multiply then an
add/xor. Each bit of the result of the multiply is obtained through 8 boolean multiplies/ands.
Hope that helps!
Reply
Vincent 6 years ago
Hi Jeff, is it possible to show your working on f({18})={6a}? I have been trying to work out the
rotational matrix part but still getting the answer wrong. Did you sum up all the 8 rows of
multiplication before you XOR with {63}?
Is it possible can anyone show the working for multiple inverse for {58} is {18}?
Reply
Krishnaprasad 6 years ago
This is great.. lot of effort to explain, very easy to understand!! awesome..
Anonymous 6 years ago
W d f l! G t k!
Share ›
Share ›
Share ›
Share ›
Share ›
Share ›
Share ›
1/20/2018 A Stick Figure Guide to the Advanced Encryption Standard (AES)
http://www.moserware.com/2009/09/stick-figure-guide-to-advanced.html 44/45
Reply
Wonderful! Great work!
Makes understanding AES a lot of fun!
Genius!
Reply
txipi 6 years ago
Awesome!!!
My humble contribution to your great work, a Spanish translation:
http://www.slideshare.net/t...
Reply
The Grey Man 6 years ago
WOW. Thanks for the excellent, amusing and visual run down on AES.
Reply
SherryL 6 years ago
Wow, it's great to explain the AES this way. I've tried much to understand AES before I found
this. BRAVO! Thanks!
Reply
Anonymous 6 years ago
I would like to read more like this..it was a fun way of learning for an adult.
Reply
Anonymous 6 years ago
Thanks for this.
Reply
Jeff Moser 6 years ago
20 box: It's a decent book if you want a very academic overview of AES. It was a bit too
academic for my tastes and was one of the reasons why I created this post.
If you're looking for a more hands-on/pragmatic understanding of AES, I'd recommend you
just read and understand the source code that I included with this post.
Reply
20 box 6 years ago
Is that book you recommended is good? I am considering buying it here in India but it is too
costly a book for Indian standards and is not available on local markets.. so have to buy it
from amazon or something.. but too costly..
Just want to know if it is worth $100 or not? as it would be the price for me including
shipping...
Share ›
Share ›
Share ›
Share ›
Share ›
Share ›
Share ›
Share ›
1/20/2018 A Stick Figure Guide to the Advanced Encryption Standard (AES)
http://www.moserware.com/2009/09/stick-figure-guide-to-advanced.html 45/45
© 2015
Reply
Sandoval 7 years ago
wow!
99.9% of comp professionals never can talk in simple English; BUT you've just proved that
you are the 0.1%!
Reply
<Martani/> Fakhrou 7 years ago
Totally awesome,
this is gonna help me in my crypto exam tomorrow :D
Reply
arun 7 years ago
hey man..a very well explained..good job..
well m also working on AES and m really a bad prograamer..My work is with Equivalent
Inverse Cipher have you worked on it...got nay code of it????It's really urgent......pls
Reply
Viviana 7 years ago
Thanks a LOT for this explanation!
I nearly had given up trying to understand AES when I found that..!
Anonymous 7 years ago
After reading this I am not sure if I successfully crypt-ed or decrypt-ed my knowledge about
AES.
Share ›
Share ›
Share ›
Share ›

Navigation menu