镜像站点 · 本页由第三方 GitHub 只读镜像提供,非 GitHub 官方站点,不接受任何登录或凭据输入。前往 github.com
Skip to content

Document that StreamingXXHash32.asChecksum() returns only 28 bits - #140

Merged
yawkat merged 1 commit into
mainfrom
fix/issue-115
Sep 25, 2026
Merged

yawkat merged 1 commit into
mainfrom
fix/issue-115

Conversation

@yawkat

@yawkat yawkat commented Sep 25, 2026

Copy link
Copy Markdown
Owner

Fixes #115.

This PR documents the existing 28-bit mask and does not change behaviour. Changing the mask would break the LZ4BlockOutputStream wire format.

  • StreamingXXHash32.asChecksum(): the Javadoc now says that getValue() returns getValue() & 0x0FFFFFFF for LZ4Block format compatibility, and points to StreamingXXHash32.getValue() for the full hash. The literal is also written as 0x0FFFFFFFL; it is the same value.
  • LZ4BlockOutputStream: the class Javadoc and the header comment describe the block header layout. They also say that the default checksum is the XXHash32 (seed 0x9747b28c) of the uncompressed block, masked to 28 bits.

Tests:

  • XXHash32Test.testAsChecksumIsMaskedTo28Bits: for all streaming implementations, asChecksum().getValue() == getValue() & 0x0FFFFFFF.
  • LZ4BlockStreamingTest.testDefaultChecksumIsMaskedTo28Bits: pins the on-wire checksum bytes of a default block stream.

🤖 Generated with Claude Code

@yawkat yawkat added this to the 1.11.4 milestone Sep 25, 2026
@yawkat
yawkat enabled auto-merge (squash) September 25, 2026 15:46
The Checksum view masks the hash to its low 28 bits, which is part of
the LZ4Block wire format. Document this on asChecksum() and in the
LZ4BlockOutputStream format description, and add tests pinning the
behaviour. No behaviour change.

Fixes #115

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@yawkat
yawkat merged commit 127f7bd into main Sep 25, 2026
6 checks passed
@yawkat
yawkat deleted the fix/issue-115 branch September 25, 2026 16:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Document that StreamingXXHash32.asChecksum() returns only 28 bits

1 participant