Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

tricky crc algorithm

Tags:

crc

I am trying to find the crc that works with the following results. The byte string consists of 2 bytes (ie. 0xCE1E) and the crc is an single byte (ie. 0x03)

byte crc
CE1E 03
CE20 45
CE22 6F
0000 C0
0001 D4
FFFF 95

Can anyone help?


2 Answers

First, 4 hex digits aren't 4 bytes. Since all your examples show 4 hex digits -- 2 bytes -- I'll assume you mean 2 bytes.

There are only 65,536 distinct hash values, here's what you do.

Execute the hash function for all 65,536 values from 0000 to FFFF. Tabulate the results. That table is the function. It maps input value to output value.

While lame, it's always correct, it's not terribly big (65K bytes), and it's really fast after you've done the calculation.

You can't reverse engineer hash functions very easily. The good ones are sophisticated state machines that use all of the input bits in some "fair" way so that the output values are dramatically different for input values that differ by only a few bits.

If you compare 0000 with 0001, 0002, 0004, 0008, 0010, 0020, 0040, 0080, 0100, 0200, 0400, 0800, 1000, 2000, 4000 and 8000, you might be able to figure out what each bit contributes to the hash. But I doubt it.

like image 187
S.Lott Avatar answered Sep 19 '26 03:09

S.Lott


Assuming they are two byte (16 bit) values, I've tried a few on some online CRC generators without getting your results. So it looks like it's not a commonly used CRC algorithm.

Do you have any clues about the likely algorithm? Or is this a homework assignment and you're supposed to reverse-engineer the CRC algorithm/parameters?

Summary: more information needed.

like image 24
The Archetypal Paul Avatar answered Sep 19 '26 03:09

The Archetypal Paul



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!