r/AskReverseEngineering • • Feb 24 '25

Reverse-engineering an unknown checksum algorithm

I am trying to reverse-engineer a protocol that includes a final byte, which appears to be a checksum of some kind—possibly CRC-8 or another checksum algorithm with unknown parameters. The data has a fixed length, and I have collected multiple messages along with their respective checksums. Despite attempting to use reveng, I have not been able to determine the exact algorithm or parameters.

I have analyzed messages with small differences and have observed patterns where modifying a single bit in the data results in systematic changes in the checksum (following this tutorial). Specifically:

  • When XORing two messages with small differences, the resulting CRC difference exhibits bitwise shifting behavior:
383c80404070a515a53364f5a1315db1
383c80404070a515a53364f5a1345d77
383c80404070a515a53364f5a1355db6
383c80404070a515a53364f5a1385d7e
383c80404070a515a53364f5a1395dbf
383c80404070a515a53364f5a13a5dfd
383c80404070a515a53364f5a13b5d3c
                           ^
  • Differences after XORing:
0100C1
020083
040007
08000E
  • Some cases suggest that if the most significant bit (MSB) of the CRC is shifted out as 1, the resulting CRC is XORed with 1.
  • However, this pattern does not always hold, as there are cases where the difference follows a more complex pattern.

The full dataset of collected messages is available here.

How can I determine the algorithm and parameters used to generate this checksum? Could it be CRC-8, a custom polynomial, or another type of checksum?

5 Upvotes

4 comments sorted by