Converting to HEX and deHex increase end String value + 1
Posted: Thu Dec 30, 2021 3:02 pm
Hi all,
I have small issue that i cant figure out why.
uint8_t nonce[16] = "1234567890123456";
String cipherText = String();
for (int i = 0; i < 17; i++) {
char str[3];
sprintf(str, "%02X", nonce);
cipherText = cipherText+String(str);
}
System.println(cipherText);
result is: "31323334353637383930313233343537"
when i use hex converter online the de hex result is "1234567890123457"
hex converter online: https://string-functions.com/hex-string.aspx
The last value will always increase + 1
Anyone can help whats wrong with this codes?
I have small issue that i cant figure out why.
uint8_t nonce[16] = "1234567890123456";
String cipherText = String();
for (int i = 0; i < 17; i++) {
char str[3];
sprintf(str, "%02X", nonce);
cipherText = cipherText+String(str);
}
System.println(cipherText);
result is: "31323334353637383930313233343537"
when i use hex converter online the de hex result is "1234567890123457"
hex converter online: https://string-functions.com/hex-string.aspx
The last value will always increase + 1
Anyone can help whats wrong with this codes?