dweiss commented on PR #811:
URL: https://github.com/apache/commons-compress/pull/811#issuecomment-5461200306
> Commons Compress already depends on Commons Codec where you'll find
`org.apache.commons.codec.digest.PureJavaCrc32` and
`org.apache.commons.codec.digest.PureJavaCrc32C`.
Good to know, thank you. Unfortunately this won't work here because bzip2
uses a different byte/bit ordering from standard crc32 (or crc32c)
implementations. So it's very specific to this algorithm. Here's the LLM
explaining the details:
- PureJavaCrc32C: wrong polynomial (Castagnoli). It can't produce bzip2's
CRC under any transformation. Unusable.
- PureJavaCrc32: right polynomial, wrong bit orientation
(reflected/LSB-first; bzip2 is MSB-first). Usable only via
reverse32(crc(reverse8(M))), which costs a
bit-reversal pass per byte — and since it's plain Java slicing-by-8 with
no intrinsic behind it, you'd pay that pass on top of essentially the same table
computation the tree already does. Net effect ≈ 1.6× slower CRC than the
current class, for the sake of deleting ~60 lines.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]