{
  "slug": "adler-32",
  "term": "Adler-32",
  "aliases": [
    "Adler32",
    "ADLER32"
  ],
  "definition": "Adler-32 is a 32-bit checksum formed from two running sums modulo 65521.",
  "note": "Start with s1=1, s2=0. For byte b, update s1=(s1+b) mod 65521, then s2=(s2+s1) mod 65521. Return 65536*s2+s1; empty input gives 1. The zlib trailer stores it most-significant byte first. [rfc1950]\n\nThe trailer covers decoded output, not compressed bytes or the separately supplied dictionary. Dictionary bytes copied into output are covered. DICTID separately checks the dictionary. A compliant decoder must check ADLER32 and report a mismatch. [rfc1950]\n\nRaw DEFLATE has no wrapper checksum; gzip uses CRC32. The zlib library handles all three, so its name does not identify the checksum. Adler-32 supports incremental updates. [zlib-manual]\n\nThe bytes 00 02 00 and 01 00 01 both have s1=3, s2=7 and checksum 0x00070003. Changes +1,-2,+1 cancel both sums. These deliberate collisions are not estimates of accidental-corruption frequency. [hesela-arithmetic] [hesela-archives]\n\nRFC 3309 explains SCTP's 2002 switch to CRC32C, including short-packet nonuniformity. For 128 bytes, s1 is between 1 and 32641 and cannot wrap. Neither is a storage error-rate estimate. [rfc3309] [hesela-arithmetic]\n\nAll 65536 two-byte inputs have distinct checksums. The sums s1=1+a+b and s2=2+2*a+b give a=s2-s1-1 and b=2*s1-s2. Exhaustive checks confirm this fixed-length result. It does not extend to the three-byte collision above. Unused output values alone do not determine undetected-error probability. [hesela-arithmetic]",
  "status": "shipping",
  "advantages": [
    {
      "text": "Incremental updates allow the same checksum to be computed while processing successive chunks.",
      "citationIds": [
        "zlib-manual"
      ]
    }
  ],
  "limitations": [
    {
      "text": "A matching value does not prove byte identity or authenticate data; the constructed collision changes the input without changing its original checksum.",
      "citationIds": [
        "hesela-arithmetic",
        "hesela-archives"
      ]
    },
    {
      "text": "Output width alone does not imply an undetected-error probability of 2^-32; message length, contents and the error model matter.",
      "citationIds": [
        "rfc3309"
      ]
    }
  ],
  "related": [
    "checksum",
    "deflate",
    "gzip",
    "compression-dictionary",
    "crc32c",
    "hash-collision"
  ],
  "supersedes": [],
  "supersededBy": [],
  "firstSeen": null,
  "lastSeen": null,
  "citations": [
    {
      "id": "rfc1950",
      "title": "RFC 1950: ZLIB Compressed Data Format Specification version 3.3, sections 2.2-2.3",
      "url": "https://www.rfc-editor.org/rfc/rfc1950.html",
      "accessed": "2026-11-22"
    },
    {
      "id": "zlib-manual",
      "title": "zlib manual: inflateInit2, deflateSetDictionary and checksum functions",
      "url": "https://zlib.net/manual.html",
      "accessed": "2026-11-22"
    },
    {
      "id": "rfc3309",
      "title": "RFC 3309: SCTP Checksum Change, section 1 (September 2002)",
      "url": "https://www.rfc-editor.org/rfc/rfc3309.html",
      "accessed": "2026-11-22"
    },
    {
      "id": "hesela-arithmetic",
      "title": "Hesela: Adler-32 arithmetic and native zlib regression checks",
      "url": "https://hesela.dev/research/adler32-contract.py",
      "accessed": "2026-11-22"
    },
    {
      "id": "hesela-archives",
      "title": "Hesela: When both zlib checksums accept the wrong dictionary",
      "url": "https://hesela.com/analyses/compressed-archives-dictionary-dependencies/#zlib-dictionary-alias",
      "accessed": "2026-11-22"
    }
  ],
  "updated": "2026-11-22",
  "provenance": [
    "Primary-format and API synthesis. RFC 1950 is Informational; RFC 3309 supplies historical SCTP context. The illustrative collision is exact arithmetic with native-library controls, not a new codec defect, benchmark or hardware experiment."
  ]
}
