You can download and run the project locally. Be sure that you set up the environment for the CAIRO as in the following link. https://www.cairo-lang.org/docs/quickstart.html
- test_aes_128_encrypt.cairo
cairo-compile tests/test_aes_128_encrypt.cairo --output test_compiled.json
cairo-run --program=test_compiled.json --print_output --print_info --relocate_prints --layout=all
- test_aes_128_encrypt.cairo
cairo-compile tests/test_aes_128_decrypt.cairo --output test_compiled.json
cairo-run --program=test_compiled.json --print_output --print_info --relocate_prints --layout=all
func aes_128_encrypt{range_check_ptr, bitwise_ptr : BitwiseBuiltin*}(input : felt*, input_key : felt, array_length : felt) -> (result : felt*):
func aes_128_decrypt{range_check_ptr, bitwise_ptr : BitwiseBuiltin*}(input : felt*, input_key : felt, array_length : felt) -> (result : felt*):
Both of the functions above requires three paramaters.
input : felt* -> an array of 128-bits, the plaintext that exceeds 128-bits must be divided into array of 128-bits. If any element in the "input array" exceeds the 128-bits, the functions above will fail.
input_key : felt -> 128-bits AES-key, the functions will fail if it exceeds the required number of bits.
array_lenght : felt -> length of the "input", it must be entered correctly to get a correct ciphertext.
The functions are implemented according to NIST-FIPS-197
For mix column and inverse mix column operations, lookup tables are used to reduce the number of total steps. Also, for s-box and inverse s-box lookup tables are used.
1 KB data is encrypted in ~475K steps 1 KB data is decrypted in ~490k steps
~2 KB data can be encrypted or decrypted in one transaction.
AES-256