Skip to content
This repository was archived by the owner on Apr 18, 2026. It is now read-only.
This repository was archived by the owner on Apr 18, 2026. It is now read-only.

Adler32 isn't initialized correctly #66

Description

@ehrmann

The code that calls out to the adler32 implementation uses an initial value of 0, not 1, so it won't be compatible with other adler32 implementations (though there are workarounds).

The easiest way to verify is computing an empty checksum:

printf("Empty adler32: %llu\n", ComputeAdler32("", 0));

Compare this to Java or Python's implementations. Or the spec (see "Appendix: Sample code").

Fixing this with a breaking change is probably more trouble than it's worth; there's enough deltas out there that it would cause people problems, and this shouldn't(?) affect the quality of the checksum since 0 is a valid adler32 value, but it'd be a good idea to document it somewhere.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions