Is CRC32 additive?

前端 未结 4 952
遥遥无期
遥遥无期 2021-01-04 12:41

On several places I\'ve read that crc32 is additive and so: CRC(A xor B) = CRC(A) xor CRC(B).

The above statement was disproven by the following code I wrote:

<
4条回答
  •  伪装坚强ぢ
    2021-01-04 12:56

    If a, b, and c are the same length, CRC(a) xor CRC(b) xor CRC(c) equals CRC(a xor b xor c). Returning to your original formulation, it means that CRC(a xor b) equals CRC(a) xor CRC(b) xor CRC(z), where z is a sequence of zeroes the same length as the other two sequences.

提交回复
热议问题