0

Suppose I have a 32 bit CRC function $\text{crc32}(x)$ that satisfies all the properties of a CRC. Suppose also that I am a lazy developer who wants to create a 64 bit CRC function but doesn't want to actually have to implement another CRC, so I design a function

$$ f(x)= \text{crc32}( {\tt{"}\tt{foo}\tt{"}}\ ||\ x ) \cdot 2^{32} + \text{crc32}( {\tt{"}\tt{bar}\tt{"}}\ ||\ x ) $$ Does $f$ form a CRC?

  • 1
    Regarding "all the properties of a CRC," you linked to a wikipedia page that is not a list of "all the properties of a CRC" but rather is a long page with explanations of what a CRC is... but various explanations are not consistent in their properties. Can you list all the desired properties rather than providing a link to a long web page that would have to be parsed and interpreted by us? Anyways, it you just want a hash that is 64-bit they you have constructed one. But if you actually want to do error correction, I'm not sure. What do you want to do? – hft Apr 13 '22 at 01:17

1 Answers1

2

Your $f$ is exactly equivalent to this:

$$f(x) = (\text{crc32}(x) \oplus C_1)\ || \ (\text{crc32}(x) \oplus C_2)$$

For appropriate $C_1, C_2$ values that depend on the length of $X$; $C_1 = \text{crc32}(\text{"foo"} || 0^{\text{len}(X)}) \oplus \text{crc32}(0^{\text{len}(X)})$, and $C_2 = \text{crc32}(\text{"bar"} || 0^{\text{len}(X)}) \oplus \text{crc32}(0^{\text{len}(X)})$

That is, it is effectively the crc32 of $x$ twice, except that certain bits of the first and second copy are flipped; which bits depend on the length of $x$, but nothing else.

This means that the error detection properties of your function are effectively that of crc32, and nothing better.

poncho
  • 147,019
  • 11
  • 229
  • 360