2 //#include "./printf.h"
6 byte *key = (unsigned char*)"0123456789010123";
7 const int size_mesg=256;
14 //real iv = iv x2 ex: 01234567 = 0123456701234567
15 unsigned long long int my_iv = 36753562;
29 Serial.begin (57600) ;
32 // printf("\n===testng mode\n") ;
50 void prekey (int bits)
56 byte plain[size_mesg];
57 byte cipher [size_mesg] ;
58 byte check [size_mesg] ;
61 for(int i=0;i<size_mesg;i++) {
69 unsigned long ms = micros ();
73 aes.do_aes_encrypt(plain,size_mesg,cipher,key,bits,iv);
74 Serial.print("Encryption took: ");
75 Serial.println(micros() - ms);
79 aes.do_aes_decrypt(cipher,size_mesg,check,key,bits,iv);
80 Serial.print("Decryption took: ");
81 Serial.println(micros() - ms);
82 /* printf("\n\nPLAIN :");
83 aes.printArray(plain,(bool)true);
85 aes.printArray(cipher,(bool)false);
87 aes.printArray(check,(bool)true);
89 aes.printArray(iv,16);
90 printf("\n============================================================\n");
94 for(int i=0;i<size_mesg-1;i++) {
96 if(check[i]!=plain[i]) {
97 printf("%d %d %d\n",plain[i],check[i],i);
101 printf("CHECK %d\n",equal);