libcrc icon indicating copy to clipboard operation
libcrc copied to clipboard

How to properly work with crc16 function

Open bilaljo opened this issue 3 years ago • 0 comments

Hello,

I have a string of hex numbers (in Hex representation; like "AB12F1") for which I would like to calculate (and check) the CRC sum with crc16 (the hex-string is read from a transmitted file). However, I'm unsure how to use it properly. Should I feed the function with the entire hex-string, as raw string? In the sense of, interpreting every single character of the string as byte. Or should I rather convert every hex-representation (2 hex digits) into bytes? I tested both without any success.

I'm also unsure where I have to put the checksum - I actually tested to place it in the back of the string (as usual), but this doesn't work (results in a new CRC value, which isn't 0). Furthermore, I also tried to convert the checksum first to an ASCII representation, but this also doesn't work.

Thank you!

bilaljo avatar Sep 05 '22 08:09 bilaljo