X-Git-Url: https://bilbo.iut-bm.univ-fcomte.fr/and/gitweb/Cipher_code.git/blobdiff_plain/3935cf9ac06b7bc328ee3d942edb5f60130d5b74..a499b7a7cd64ba86ef4536a9ef7792566f379822:/Arduino/sketch_AES/sketch_AES.ino?ds=inline diff --git a/Arduino/sketch_AES/sketch_AES.ino b/Arduino/sketch_AES/sketch_AES.ino index 06cdcf2..5fbe12b 100644 --- a/Arduino/sketch_AES/sketch_AES.ino +++ b/Arduino/sketch_AES/sketch_AES.ino @@ -1,10 +1,12 @@ -#include +//#include + +#include //#include "./printf.h" AES aes ; byte *key = (unsigned char*)"0123456789010123"; -const int size_mesg=256; +const int size_mesg=16*15; @@ -18,9 +20,15 @@ unsigned long long int my_iv = 36753562; +unsigned char NwkSkey[16] = { + 0x2B, 0x7E, 0x15, 0x16, 0x28, 0xAE, 0xD2, 0xA6, + 0xAB, 0xF7, 0x15, 0x88, 0x09, 0xCF, 0x4F, 0x3C +}; - - +unsigned char AppSkey[16] = { + 0x2B, 0x7E, 0x15, 0x16, 0x28, 0xAE, 0xD2, 0xA6, + 0xAB, 0xF7, 0x15, 0x88, 0x09, 0xCF, 0x4F, 0x3C +}; @@ -98,12 +106,32 @@ void prekey (int bits) equal=false; } } - printf("CHECK %d\n",equal); - + Serial.print("CHECK "); + Serial.println(equal); + + for(int i=0;i<16;i++) { + Serial.print(plain[i]); + Serial.print(" "); + } + Serial.println(); + + ms = micros (); + AES_Encrypt(plain,AppSkey); + int time=micros() - ms; + Serial.print("new enc took: "); + Serial.println(time); + + for(int i=0;i<16;i++) { + Serial.print(plain[i]); + Serial.print(" "); + } + Serial.println(); + + + } void prekey_test () { prekey (128) ; } -