AES implementation in C (study project)
AES algorithms are implemented as a standalone C99 library (aes.* files).
Supported features:
make
After compiling the tool, you can compile and run tests with:
make test
These tests are performed for cipher and decipher, and for all size key (Using NIST’s documentation examples).
make bench
Give the encryption runtime (in seconds) and max memory footprints (in bytes) after N=100
iterations for all modes and all sizes key. You can also give an other value to N
, for example with 50
:
make bench N=50
To see help in shell use: ./AES -h
Usage:
./AES [-d] [-m MODE] [-k FILE|STR] [-s SIZE] [-v] [-h] FILE
Arguments:
-d, Enable decrypt mode (default is encrypt)
-m, Expects string MODE (default is ECB)
MODE = ECB | CBC
-k, Can be a hex string or path to file that contains hex string
- For example to set a 128-bits use
-k 0102030405060708090A0B0C0D0E0F10
or put the same string in a file and give file path to -k
-s, Create a random key in a file named rkey.key
-v, Enable verbose mode
-h, Show this message and exit
alice
with the file key256
which countain a 256-bits key with default mode (EBC):This command create a new file named
./AES -k toys/key256 toys/alice
cipher
which contain the encrypted text.cipher
text:This command create a new file named
./AES -k toys/key256 -d cipher
decipher
which contain the decrypted text../AES -s 192 -m CBC toys/alice
(Create both an I.V. in iv
and a random key in rkey.key
)../AES -k rkey.key -m CBC -d cipher
(Use the previously created iv
)