Rijndael (AES) is one of many ciphers that belong to Advanced Encryption Stantard (AES). Generally, AES term refers to rijndael algorithm, although there are many other candidates of AES cipher. Rijndael algorithm was developed by Vincent Rijmen and Joan Daemen that won the FIPS’s AES cryptographic algorithm submission.
Unlike blowfish, Rijndael or AES takes litle memory. This is true since AES only has two 256 byte of SBOX tables. However, blowfish has eight 32 bit of sbox tables. So you can easily implement it on any platform of microcontroller, like what i’ve done here. AES has several version, depends on how long the key was. There are AES-128, AES-192 and AES-256. Here, to make life easier, i just code the first one (AES-128). Later on you can even coded the crazier one🙂 .
I’ve decided to choose PIC16F84 to run the implementation of AES on microcontroller. If you need an example on how to implement AES using a microcontroller such PIC16F84, you get the right page. You can grab, copy and paste this page but dont forget to mention the source🙂 . Later on, you can translate it this code into other microcontroller platform, hopefully it will increase the speed.
I encrypted “abcdefghijklmnop” string with key “0f1571c9 47d9e859 0cb7add6 af7f6798” i get “110aaff3 f2d56c9e 691a95a5 2e1928eb” as the result which is the same as an “AES Example” that i found from http://people.eku.edu/styere/Encrypt/JS-AES.html . Open that link, it shows you how AES was done, step by step.
As a benchmark first, all of encrypting routine and sbox tables takes 835 lines of program memory. The program tooks 11.62 ms to cipher one block of plain text. I’ll keep modifying the code until it reach the fastest one.
Here is the screenshot, I took it from MPLAB 5.20
Finally, i’ve added decryption routine into the code. I also simplified the algorithm to reduce memory usage. You know that speed and memory usage are trading off. Surely the speed was decreased, but i think it’s fair enough comparing to reducing memory usage. You can find the latest implementation (version 1.4), which is more complete and faster than before.
AES (Rijndael) Simulator
– RS232 Serial Encryptor using PIC16F84