Search code examples
crc

CRC 8 and CRC 16


CRC 16

http://www.lammertbies.nl/comm/info/crc-calculation.html

For input of hex 0x43 the CRC-16 (poly 0x8005) is 0xF141 as per above website...

How do I input this in below calculator to get same result?

https://ghsi.de/CRC/index.php?Polynom=1000000000000101&Message=43

CRC 8

http://www.codeproject.com/Articles/19059/C-CCITT-CRC-Algorithm

In above link with byte array {0xee, 0x01, 0x13, 0x00, 0x06, 0x1c, 0x00, 0x20, 0x1d, 0x00, 0x00} using CRC8 (poly 0xd5) it return 226 as a result.

How do I go about and insert the value into below website?

How about input 0x43? How do I input this using CRC8 (poly 0xd5) into the same website?

https://ghsi.de/CRC/

Sorry but I've been stucked on figuring out this... been studying CRC using below link until pg 11, and I have a rough idea on CRC calculation. But I have found difficulties in figuring how to get same result from the sources I mentioned above...

http://www.ross.net/crc/download/crc_v3.txt


Solution

  • For the CRC-16, use this link with the polynomial corrected to have the x16 term and the input byte reversed, and read the CRC result (828f) reversed (f141). The input and output need to be reversed since that is a reflected CRC. See the definition of that CRC here.

    For the CRC-8, defining just the polynomial is not sufficient. You also need to define whether the CRC is reflected or not, what the initial value of the CRC register is, and what to exclusive-or the result with. There is one in the catalogue with that polynomial, which is not reflected and has zero for the initial value and final xor. You can use this online version for that specific CRC to get 0x37 as the CRC of 0x43. That version gives 226 decimal for your example sequence.