Reputation: 383
I have a problem with CRC. My message in hex is: 80 00 00 03 an the crc is f5 1f. I thought, the polynom is 0x1021 (crc-ccitt kermit). How to find out, what polynom the right one is? And how can I see, if I need it reversed and if the initial value is 0xffff or 0x0000 or something else? How can I calc the polynom I am searching for? Do I have to convert the 80 00 00 03 and the f5 f1 to BIN and then divide both? I tried to clac myself with the prog reveng, but that was not successful. Maybe because I have not all params -.-
I found a php-function HERE
but that will not calc the right sum for me. Maybe it is not CRC-CCITT KERMIT in that php-function
Upvotes: 1
Views: 4955
Reputation: 112374
0x1ff5
is indeed the CRC-CCITT (Kermit) of 80 00 00 03
. (It is apparently stored in little-endian order in your stream.)
The PHP code you found is for the false "CRC-CCITT", which you can find in the RevEng catalog here.
The true CRC-CCITT (Kermit) parameters are here in that catalog. The bits are reversed, so you use the polynomial reversed, 0x8408
, and you shift the bits down instead of up. The initial register contents are zero, and there is no final exclusive-or.
Upvotes: 2