-
Notifications
You must be signed in to change notification settings - Fork 35
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
CRC32C Checksum support #83
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
zlib gem is a frontend for zlib native library, so I'm wondering whether it is appropriate to introduce adopted code (even with a tiny modification) here. Maybe creating a separate native extension gem (by bringing this adopted and modified code) satisfies the need?
I had chatted with @hsbt and he seemed ok with the idea. |
Umm I'd like to confirm your motivation or background to introduce an adopted code in the frontend gem. I'm not strongly opposite, but it sounds bringing some complexity to the simple frontend code. |
The motivation was for CRC32C to be in a bundled gem such as zlib instead of having our customers install other gems to use it. S3 provides checksum support using CRC32C. In general, we prefer not to take dependencies where possible, unless it's on stdlib. We currently have a C implementation in the |
Seems that Zlib's author does not want CRC32C upstream - madler/zlib#981. It would still be nice to be part of this gem but I'm open to other ideas. I think a bundled gem of some sort is preferred in either case. |
I am against including this in zlib. It would be best to maintain this as a separate gem. There would have to be a strong case made for bundling such a gem with Ruby, considering the direction of moving things out of stdlib to bundled gems, and unbundling gems previously bundled. |
I understand your position. I'm happy to drop this if the ruby core team wants. |
Adds CRC32C checksum support into Zlib, which includes methods:
crc32c_table
,crc32c
, andcrc32c_combine
. Whenever CRC32 is supported, these methods should also exist.Zlib itself does NOT have CRC32C support. CRC32C is a similar calculation to CRC32C except using a different polynomial. In this approach, I am defining a
crc32c
method that follows the interface ofdo_checksum
and the function it calls in Zlib. Forcrc32c_combine
, I had to replicate the existingcrc32_combine
code but with the other polynomial.I've also refactored
crc_table
to be calledcrc32_table
but otherwise preserved backwards compatibility by having both methods.