I want to implement CRC8 generator. CRC8-ATM works without problems. However, when using the polynomial of CRC8-MAXIM, the calculation result is different. Did I calculate the wrong way?
==============================
CRC8-ATM
dat: "AB" = 01000001 01000010
ply: 0x107 = 100000111
res: 0x87
==============================
01000001 01000010 00000000
1000001 11
----------------------------
10000010 00000000
10000011 1
----------------------------
1 1000000
1 00000111
----------------------------
my_res: 10000111 => 0x87 (OK)
==============================
CRC8-MAXIM
dat: "AB" = 01000001 01000010
ply: 0x131 = 100110001
res: 0xA5
==============================
01000001 01000010 00000000
1001100 01
----------------------------
1101 00000010 00000000
1001 10001
----------------------------
100 10001010 00000000
100 110001
----------------------------
1001110 00000000
1001100 01
----------------------------
10 01000000
10 0110001
----------------------------
my_res : 00100010 => 0x22 (Must be 0xA5)
For the calculation results, refer to the site below.
If anyone is familiar with the implementation of CRC8, please help.
Yes, there is.
Regular CRC-8 and CRC-8/MAXIM have different
RefInandRefOutconfigurations :RefInparameter indicates if the data byte should be reversed before being used.RefOutparameter indicates if the computed CRC should be reversed before appling the finalXorOutoperation.Here is a piece of code computing CRC8 algorithms:
It outputs:
Note that most of the time
RefInandRefOuthave the same value, and code optimization is possible (i.e. avoiding all byte reversing operations).