0
votes

Suppose I have selected an appropriate CRC polynomial and know the content and size of the data frame I want to protect ... How do I choose the optimal initial value?

It is known that CRCs with an initial value of 0 have a blind spot for messages with leading zeros. For this reason, many articles and websites mention / recommend an initial value of all-ones, as this fixes the blind spot.

My question: Does all-ones have any disadvantages? Can there be a better initial value than all-ones if the specific known data frame is taken into account?

1

1 Answers

3
votes

Although a CRC initialized to zero is not affected by leading zeroes, if during transmission any of those leading zeroes become non-zero due to error it will detect the error. What it won't catch is a shortened message where some of the leading zeroes are dropped from the message, resulting in a shortened message, which could be an issue if there is no separate length check. Using all ones will catch such a shortened message. Actually any non-zero initial CRC will catch a shortened message. All ones is just convenient. One variation is to use the a CRC generated from a short data pattern of all ones for the initial value, like 16 one bits used as data for a 16 bit CRC to generate the initial CRC (this will be a constant, so it would be computed in advance), which would be the equivalent of prepending the data with all 1 bits and initializing the CRC to 0.