kukuruzo91
kukuruzo91

Reputation: 111

Why we need to invert crc? In which cases we need to do this?

Why we need to invert crc? In which cases we need to do this? (invert mean crc = ~crc)

Is it defence from zero cases (when whole message is consists of zeros)?

How it helps in this case?

Upvotes: 2

Views: 3137

Answers (1)

Mark Adler
Mark Adler

Reputation: 112239

You mean invert, or take the one's complement. (Reverse would mean swapping the order of the bits, undoing a CRC calculation, or reverse-engineering the CRC parameters.)

That is done when the CRC parameters are defined that way. See this list of CRCs, where those with xorout defined as all 1's are inverting the CRC before return.

A common example is when the initial register contents, init is also all 1's, so the final xorout then makes the CRC of an empty string zero. The init being non-zero is how you "defend" against the all-zeros message case, which assures that every zero changes the CRC. The xorout then just provides the nicety of a CRC of an empty message being zero. There are CRC definitions there with zero xorout (no invert or exclusive-or at the end), but a non-zero init, which provides that defense as well.

Upvotes: 1

Related Questions