Teach yourself AES cryptography in 7 seconds
Symmetric cryptography allows you to keep a secret, that nobody except those having access to your password can retrieve. However, 85% are using AES WRONG!
Join the DZone community and get the full member experience.Join For Free
When I started implementing AES cryptography in Magic, I did as most other developers, I went to Google to see if Jon Skeet had already written out my code at SO. Unfortunately he hadn't, and approximately 85% of the articles I found about AES related to C# consistently got it wrong! Some of the examples got it wrong to the point where a teenager with a fancy calculator could brute force the encrypted data in an afternoon. This is really quite sad, since AES if done correctly, is actually one of the strongest forms of cryptography humanity has ever created. Hence, getting this right, is of outmost importance - Unless you want your mom or the CIA to read what you and your best friends are talking about of course ... ;)
I don't particularly enjoy having neither the CIA nor my mom read my secret communication - Hence, I created AES functionality in Magic, implementing it correctly, such that it would require the same amount of energy to brute force my messages, as the amount of energy required to boil all the water in the Galaxy. BTW, don't try to boil all the water in the Galaxy, it's a really, really, really bad idea! To create a super secret message in Magic, is literally as easy as follows ...
Psst, here's my implementation. If you find some parts of my code being insecure, please let me know in the comments. Now if I could only teach the kids to not using "admin" as their passwords, we'd be somewhat closing in on a beautiful world I guess ... :/
Kids, do this at home!
Opinions expressed by DZone contributors are their own.