Reversed message CRC calculation

599 Views Asked by At

Consider you have this message (ab,cd,ef) and you have the ROHC (Robust header compression) CRC8 polynomial e0.

C(x) = x^0 + x^1 + x^2 + x^8

Is there any way that I can calculate the CRC on the message backward starting from the last byte and get the same results as if I am calculating it on the original message?

1

There are 1 best solutions below

0
On

No this is generally not possible for your polynomial (100000111).

EG: 110100111/100000111 = 011010011
but: 111001011/xxxxxxxxx != 011010011 (in general)

However, you can still check for the validity of your message if you know the CRC beforehand.

EG: 110100111/100000111 = 01101001
    => message transmitted = 11010011 01101001
    => message received (reversed) = 10010110 11001011

then: 10010110 11001011/111000001 == 0
(where: 111000001 = reversed(100000111))

=> crc(reversed(11001011)) = crc(11010011) == reversed(10010110) = 01101001

Note that this is only true if the message is reversed BITEWISE.

IE: reversed(ABC) = reversed(101010111100) = 001111010101
= 3D5 = reversed(ABC) != CBA = 110010111010 != reversed(101010111100)

So be careful when implementing your algorithm ;-)