Reputation: 33
I have a the generator polynomial which has to be converted to binary number to use in my CRC code.Like for example these are the one's that are converted correctly, I want to know how they are done.
These are used for ROHC CRC computation:
The polynomial to be used for the 3 bit CRC is: C(x) = 1 + x + x^3
this is 0x06 The polynomial to be used for the 7 bit CRC is: C(x) = 1 + x + x^2 + x^3 + x^6 + x^7
this is 0x79
want to know how 0x06 and 0x79 are derived from those equations.
Upvotes: 3
Views: 11807
Reputation: 471229
Those appear to be in reversed binary notation.
When representing CRC polynomials, each term maps to one bit. Furthermore, the highest order term is implicit and is omitted.
So breaking down your two examples:
1 + x + x^3 = 1101
1 + x + x^2 + x^3 + x^6 + x^7 = 11110011
Chopping off the highest order term:
1101 -> 110 = 0x06
11110011 -> 1111001 = 0x79
Upvotes: 3