How to calculate the ckecksum XOR of a string to send via Serial, as full string security?
Thank you in advance
I assume you are looking for a CRC check rather than a simple checksum
have a look at CRC8-Library
1 Like
receive the whole string, put it in array and calculate CRC byte by byte
I do it the easy way, I process each byte as it comes in then after the last byte I do the xor and inc and it is there.
checksums are typically added to data to ensure integrity..
hashes of strings are used to add a bit of security..
for some reason i'm thinking you're looking for a hash function, i could be wrong..
//djb2
uint32_t hash(char *str){
uint32_t hash = 5381;
int c;
while (c = *str++)
hash = ((hash << 5) + hash) + c; /* hash * 33 + c */
return hash;
}
Happy New Year!!
good luck.. ~q
This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.