Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void decryptCounter(String zt){
- int length = zt.length();
- byte pole [16];
- int poc = 0;
- for(int i = 0; i < length;i=i+2){
- String pom = String(zt.charAt(i)) + String(zt.charAt(i+1));
- pole[poc] = int(hexToDec(pom));
- poc++;
- }
- // // vypis
- // for(int i= 0; i < 16; i++){
- // Serial.println(pole[i]);
- // }
- int blocks = 1;
- byte succ = aes.set_key (key, 128) ;
- succ = aes.decrypt (pole,decrypted) ;
- for (byte i = 0 ; i < blocks*N_BLOCK; i++)
- {
- byte val = decrypted[i];
- Serial.print(val>>4, HEX) ;
- Serial.print(val&15, HEX) ;
- // Serial.println(val);
- }
- Serial.println () ;
- // char hexaCounter [2 * NUMBEROFBYTES + 1];
- //
- // char* myPtr = &hexaCounter[0]; //or just myPtr=charArr; but the former described it better.
- // for (byte i = 0; i < NUMBEROFBYTES; i++){
- // snprintf(myPtr,3,"%02x",decrypted[i]); //convert a byte to character string, and save 2 characters (+null) to charArr;
- // myPtr += 2; //increment the pointer by two characters in charArr so that next time the null from the previous go is overwritten.
- // }
- //
- //// Serial.println("Counter v HEX:");
- //// Serial.println(hexaCounter);
- //
- // long int retVal = hexToDec(String(hexaCounter));
- //
- // return retVal;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement