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++) {
70 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);
82 aes.do_aes_decrypt(cipher,size_mesg,check,key,bits,iv);
83 Serial.print("Decryption took: ");
84 Serial.println(micros() - ms);
85 /* printf("\n\nPLAIN :");
86 aes.printArray(plain,(bool)true);
88 aes.printArray(cipher,(bool)false);
90 aes.printArray(check,(bool)true);
92 aes.printArray(iv,16);
93 printf("\n============================================================\n");
97 for(int i=0;i<size_mesg-1;i++) {
99 if(check[i]!=plain[i]) {
100 printf("%d %d %d\n",plain[i],check[i],i);
104 //printf("CHECK %d\n",equal);