This is a quick program to deminstrate the usage of mcrypt to encrypt a string.
This is only the encryption not the decryption. Decryption can be done the same way only using
- Download and install libmcrypt
..* From source: http://sourceforge.net/projects/mcrypt/files/Libmcrypt/2.5.8/libmcrypt-2.5.8.tar.gz/download
..* From yum:
yum install libmcrypt-devel..* From apt:
sudo apt-get install libmcrypt-dev
gcc -lmcrypt aes.c -o aes
There is also a
./build.sh for convenience.
- IV's need to be 16 char lengths.
- Key should also be 16 char length.
- The encryption text should be a mod of 16. So if it is under there should be padding.
rijndael-128is the same as AES-128, but
rijndael-256is not the same as AES-256
. AES was built fromrijndael-128`.
- When printing HEX text use unsigned char or else you'll get a bunch of