If you want the output displayed in a different form, just change the DUMP macro.
#include "aes256.h" //Include library files
#define DUMP(str, i, buf, sz) { Serial.println(str); \
for(i=0; i<(sz); ++i) { if(buf[i]<0x10) Serial.print('0'); Serial.print(char(buf[i]), HEX); } \
Serial.println(); } //Help function for printing the Output
aes256_context ctxt;
void setup() {
int i;
Serial.begin(9600);
Serial.println("Initializing AES256... ");
uint8_t key[] = {
0, 1, 2, 3, 4, 5, 6, 7,
8, 9, 10,11, 12, 13, 14, 15,
16, 17, 18, 19, 20, 21, 22, 23,
24, 25, 26, 27, 28, 29, 30, 31
};
DUMP("Key: ", i, key, sizeof(key));
aes256_init(&ctxt, key);
uint8_t data[] = {
'a', 's', 'd', 'f', 'a', 's', 'd', 'f',
'a', 's', 'd', 'f', 'a', 's', 'd', 'f'};
DUMP("Unencrypted data: ", i, data, sizeof(data));
aes256_encrypt_ecb(&ctxt, data);
DUMP("Encrypted data: ", i, data, sizeof(data));
aes256_decrypt_ecb(&ctxt, data);
DUMP("Back decrypted data: ", i, data, sizeof(data));
aes256_done(&ctxt);
}
void loop() {
}