-
Notifications
You must be signed in to change notification settings - Fork 18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Results Don't Agree with zlib #3
Comments
crc32 <> crc32c, see https://en.wikipedia.org/wiki/Cyclic_redundancy_check I am not familiar with zlib, what does it calculate exactly? |
Thanks for the comment. I see in the wikipedia article:
Are hardware crc32 values (crc32c) expected to be equal to software crc32 values? zlib is calculating the 32 bit cyclic redundancy check. See the python docs here. Is it different because crc32c is not what it's calculating? |
If this one is correct https://stackoverflow.com/questions/50842434/crc32-in-python-vs-crc32b then zlib implements CRC32 as used in ethernet, bzip2, gzip, png and zmodem. This lib implements CRC32C as implemented in i686/x86_64 instruction and used in iSCSI, btrfs, ext4. They are different. Edit: the differences: https://stackoverflow.com/questions/26429360/crc32-vs-crc32c |
This makes sense, thanks! |
Although the crc32c results I'm seeing are consistent with the tests in this library, they do not agree with the crc32 results of other libraries, such as zlib:
produces the output:
Calling the same with
test_string = "The quick brown fox jumps over the lazy dog"
produces the output:You can see the short phrase "The quick brown fox..." produces the same crc as in your tests, but it does not agree with zlib. The zlib result on "hello-world" agrees with all of the sources listed here.
I thought perhaps there was a difference in what was being calculated, such as returning the signed 32-bit crc rather than unsigned, but it is indeed returning a
unit32_t
, so that wouldn't explain it.This is a Google Cloud Compute instance with haswell Intel architecture. When I build the project, running
./crc32c_test
shows all tests PASSED.Do you have any guidance on what the discrepancy may be? Thanks!
The text was updated successfully, but these errors were encountered: