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

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

Closed

Description

@yawkat

StreamingXXHash32.java:106 returns getValue() & 0xFFFFFFFL. The mask has been there since 2013 (c2d417e). LZ4BlockOutputStream/LZ4BlockInputStream use this Checksum by default, so the LZ4Block on-wire checksum is truncated to 28 bits. Other implementations of the format (e.g. Netty) reproduce this, so changing the behaviour would break the wire format.

Don't change the behaviour. Instead:

  • Javadoc on asChecksum(): for compatibility with the LZ4Block format, getValue() returns only the low 28 bits. Use StreamingXXHash32.getValue() for the full hash.
  • Mention the 28-bit mask in the format description of LZ4BlockOutputStream.
  • Optionally write the constant as 0x0FFFFFFFL and add a test that pins the value.

Activity

  1. self-assigned this
    on Sep 25, 2026
  2. added a commit that references this issue on Sep 25, 2026
    fbf3207
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

documentationImprovements or additions to documentation

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions