This compiles for me without error or warning, but it seems to be crashing! It reports "encrypted:" and the hex data TWENTY-FIVE TIMES. It never gets to reporting "decrypted:"
#include <AESLib.h>
void setup()
{
Serial.begin(115200);
delay(200);
Serial.println("AES 128");
const uint8_t key[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15}; // 168 = 128 bytes
const uint16_t in = 0;
const uint8_t IV[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15};
uint8_t data[] = "The wifi Password is Bobby8990!."; //chars == bytes
unsigned long start1 = micros();//When the timer starts running before encryption
aes128_cbc_enc(key, IV, data, in); // multiple cbc (single calls)
Serial.println("encrypted:");
for (unsigned i = 0; i < sizeof(data); i++)
{
Serial.print(data[i] & 0xFF, HEX);
}
Serial.println(" ");
unsigned long diff1 = micros() - start1;// End time - start time
Serial.println(diff1);// Overall time used for encryption
unsigned long start2 = micros(); // timer starts running for decryption
aes128_cbc_dec(key, IV, data, in);
Serial.println("decrypted:");
Serial.println((const char *)data);
Serial.println("Decryption time");
unsigned long diff2 = micros() - start2;
Serial.println(diff2);
Serial.println("Time difference");
Serial.println(diff2 - diff1); // time for encryption and decryption to occur.
Serial.println("Total Time");
Serial.println(diff2 + diff1);
}
void loop()
{
}