{
  "slug": "fletcher-checksum",
  "term": "Fletcher checksum",
  "aliases": [
    "Fletcher's checksum",
    "Fletcher-16",
    "Fletcher-32"
  ],
  "definition": "A Fletcher checksum combines a running sum of data words with a running sum of that first sum to make the result sensitive to word order.",
  "note": "Classic two-sum variants use one's-complement addition, equivalent to residues modulo 2^w-1 for w-bit words. For word x, update A=A+x, then B=B+A. A 16-bit result normally uses two 8-bit sums; RFC 1146 instead names the algorithm by its word width. [rfc1146] [faa2015]\n\nOrder sensitivity has limits. With 8-bit words, 00 00 00 55 and 55 00 00 00 both give A=85, B=85 modulo 255. The moved value differs by 85 across three positions, so the change in B is 3*85=255. The original checksum stays unchanged. [arithmetic]\n\nInteroperability requires the word width, byte order, starting values, padding, zero representation and output layout. HDF5 1.14.6 initializes both sums to zero, reads 16-bit words high byte first and pads an odd final byte in the high position. [hdf5]\n\nAdler-32 instead processes bytes modulo the prime 65521. OpenZFS Fletcher-4 uses four 64-bit accumulators over 32-bit words; its four-word output is not classical Fletcher-32. [zlib-format] [zfs]\n\nRFC 1146's alternate TCP checksum options became Historic in 2011. Its algorithm description is not a recommendation to replace today's TCP checksum. [historic]",
  "status": "shipping",
  "advantages": [
    {
      "text": "Two running sums can be maintained as successive words arrive, without retaining the full message.",
      "citationIds": [
        "rfc1146"
      ]
    }
  ],
  "limitations": [
    {
      "text": "A match is not proof of byte identity or authentication, and checksum width alone does not specify an undetected-error probability.",
      "citationIds": [
        "arithmetic",
        "faa2015"
      ]
    },
    {
      "text": "The worked swaps are constructed arithmetic examples, not measurements of device faults or tests of an HDF5 file or ZFS pool.",
      "citationIds": [
        "arithmetic"
      ]
    }
  ],
  "related": [
    "checksum",
    "adler-32",
    "hash-collision",
    "hdf5",
    "cyclic-redundancy-check"
  ],
  "supersedes": [],
  "supersededBy": [],
  "firstSeen": null,
  "lastSeen": null,
  "citations": [
    {
      "id": "rfc1146",
      "title": "RFC 1146: TCP Alternate Checksum Options, appendices I-II (1990)",
      "url": "https://www.rfc-editor.org/rfc/rfc1146.html",
      "accessed": "2026-11-23"
    },
    {
      "id": "faa2015",
      "title": "Koopman, Driscoll and Hall: DOT/FAA/TC-14/49, sections 2.4, 3.6 and 3.10.3 (2015)",
      "url": "https://www.faa.gov/sites/faa.gov/files/aircraft/air_cert/design_approvals/air_software/TC-14-49.pdf",
      "accessed": "2026-11-23"
    },
    {
      "id": "arithmetic",
      "title": "Hesela: Fletcher word-order arithmetic, explicit model and exhaustive pair checks",
      "url": "https://hesela.dev/research/fletcher-order/README.txt",
      "accessed": "2026-11-23"
    },
    {
      "id": "hdf5",
      "title": "HDF5 1.14.6: H5_checksum_fletcher32 implementation",
      "url": "https://raw.githubusercontent.com/HDFGroup/hdf5/hdf5_1.14.6/src/H5checksum.c",
      "accessed": "2026-11-23"
    },
    {
      "id": "zlib-format",
      "title": "RFC 1950: ZLIB Compressed Data Format Specification version 3.3, Adler-32",
      "url": "https://www.rfc-editor.org/rfc/rfc1950.html",
      "accessed": "2026-11-23"
    },
    {
      "id": "zfs",
      "title": "OpenZFS zfs-2.3.4: scalar Fletcher-4 implementation",
      "url": "https://github.com/openzfs/zfs/blob/34f96a15c73eab27dd6ad17bb5f1263bf26e37d7/module/zcommon/zfs_fletcher.c",
      "accessed": "2026-11-23"
    },
    {
      "id": "historic",
      "title": "RFC 6247: Moving Undeployed TCP Extensions to Historic Status (2011)",
      "url": "https://www.rfc-editor.org/rfc/rfc6247.html",
      "accessed": "2026-11-23"
    }
  ],
  "updated": "2026-11-23",
  "provenance": [
    "Primary-source synthesis and exact arithmetic. The FAA report compares error-detection methods under explicit models, not observed storage-fleet failure rates. Its relevant methodology and Fletcher sections were reviewed; its simulations were not rerun.",
    "The model canonicalizes each sum to a residue. It separately exposes end-around-carry zero encodings, so a normalized pair must not be treated as a complete wire-format specification. [arithmetic]"
  ]
}
