简体   繁体   中英

Find the max. data length for a CRC polynomial and a given Hamming Distance

I am looking for a numerical algorithm to calculate the maximum data length for a given CRC polynomial and a given Hamming Distance.

Eg lets say I have an 8 bit CRC with full polynomial 0x19b. I want to achieve a Hamming Distance of 4. Now how many bits of data can be guarded under these conditions?

Is there some numerical algorithm (ideally C or C++ code) that can be used to solve this problem?

Not a complete answer, but my spoof code can be adapted to this problem.

To determine that you have not met the requirement of a Hamming distance of 4 for a given message length, you need only find a single codeword with a Hamming distance of 3. If you give spoof a set of bit locations in a message, it will determine which of those bits to invert in order to leave the CRC unchanged. Spoof simply solves a set of linear equations over GF(2) to find the bit locations to invert.

That will quickly narrow down the message lengths that will work. Once you have a candidate length, n , for which you have not been able to find a codeword of distance 3, proving that there are no such codewords will be a little more work. You would need to generate all possible 3-bit patterns, of which there are n(n-1)(n-2)/6 , and look to see if any of them have a CRC of zero. Depending on n , that might not be too daunting. A fast way to do this is to generate the CRCs of all messages with a single bit set, and exclusive-oring all choices of three CRCs from that set to see if any of those are zero.

I conjecture that there is a faster way to do that last step by intelligently culling the rows used in the linear equation solver, allowing for all bit positions. However the margin here is not sufficient for me to express the proof.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM