I'm wondering if CRC32 sum and CRC32C in particular ever return to 0? The simple answer would be "yes" given a large enough data set. However, I was wondering if there is any provisioning in CRC32C standard that would explicitly prevent this from happening.
The use case for this is that I need to be able to check if remote file is empty and all I have is its CRC32C check sum. So, in other words can I infer that if CRC32C is 0 then file is guaranteed to be empty.
If possible, please provide any reference to a standard where this is defined.
A CRC32 is only reversible if the original string is 4 bytes or less.
Return type The CRC32 function returns an 8-character string that is a text representation of the hexadecimal value of a 32-bit binary sequence.
crc32 (crc stands for cyclic redundancy check) function is not a crypto function and is meant to generate a hash that will be used to check the integrity of a file (mostly to determine if it was corrupted during download).
@Yanek is almost completely correct.
Just for fun, here is a five-character sequence that gives a CRC-32C of zero: DYB|O
. Here is a four-byte sequence in hex that gives zero: ab 9b e0 9b
. In fact, that is the only four-byte sequence that can do so. There are no one to three-byte sequences that will give you zero. That is where @Yanek is not exactly right, in that for one, two, or three-byte sequences, zero is not just as likely. The probability of getting a zero is zero in those cases.
A zero is as likely as any other value of a CRC32 checksum. A CRC is essentially the remainder of dividing the entire input (taken as one large binary number) by a pre-selected value. If the input happens to be divisible by that value, the remainder, and thus the CRC, is zero.
How about this, not a 32-bit CRC, though:
1011 | 110011001010.000
1011
----
1111
1011
----
1001
1011
----
1000
1011
----
1110
1011
----
1011
1011
----
0000 (...)
1011
----
1011
1011
----
0000
Or:
1100 | 11001010.000
1100
----
1010
1100
----
1100
1100
----
(...) 0
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With