How can I find the used CRC-16 method and polynomial for a packet of data?

48 Views Asked by At

I'm trying to find the method and polynomial that used in a packet of data like that:

00 00 41 xx xx yy yy ............................ ff
  • The first bytes (00 00 41) is a magic number that is used at the beginning of each data block.
  • xx xx is the block data #.
  • yy yy is the saved CRC-16.
  • Then we have 512 bytes (in Hex) of data.
  • The block ends with FF.

I try to use CRC reveng, but my main problem is how should I consider the data packet to feed in CRC RevEng? I know that block number affects the CRC.

Please guide me.

I need to know if I consider 00 00 41 and ff in feed data? Shall I put block number before 512 byte data or after?

1

There are 1 best solutions below

0
Mark Adler On

If the 00 00 41 is always the same, then it doesn't matter whether you include it or not. You will just get two different CRC definitions, one that will always work with it, and one that will always work without it. So just don't include it.

With no documentation on your format, it might put the xx xx before or after, and it might include the final ff or not. You'll have to try it all four ways.

It is rather unusual to have the CRC precede the data. The CRC almost always follows the data. How do you know that that's where the CRC is?

I would first look for any and all documentation before trying to reverse engineer it.