{
  "status": "shipping",
  "advantages": [],
  "limitations": [],
  "supersedes": [],
  "supersededBy": [],
  "firstSeen": null,
  "lastSeen": null,
  "updated": "2026-11-22",
  "slug": "compression-dictionary",
  "term": "Compression dictionary",
  "aliases": [
    "External compression dictionary"
  ],
  "definition": "A compression dictionary supplies reusable prior content or coding state that an encoder and decoder use to represent data more compactly.",
  "note": "Zstandard accepts raw-content and formatted dictionaries. A zero ZSTD_getDictID_fromFrame result can mean no dependency, omitted ID, insufficient bytes or invalid input; it does not prove independence. [zstd-api]\n\nRaw-dictionary controls returned wrong bytes without a checksum; the checked version rejected that mismatch. A formatted-dictionary control retained ID 123456 with changed content: unchecked output was wrong, while changing only the ID caused rejection. A numeric ID is not a digest. [hesela-zstd]\n\nIn liblz4 1.9.4, the dictionary API uses supplied bytes without comparing their identity to the frame ID. Different or omitted IDs decoded correctly with the same bytes; block-only checks allowed wrong-dictionary output. [lz4-api] [lz4-implementation] [hesela-lz4]\n\nliblz4 1.9.4 retains the initialization-time dictionary pointer within a frame; a later argument does not rebind it. Mutating retained bytes can alter independent-block output. Keep bytes stable; completion clears the binding, so supply the selected dictionary again for each dependent frame. [lz4-api] [lz4-implementation] [hesela-lz4]\n\nFor zlib, DICTID is Adler-32 over the preset dictionary; the trailer checks decoded content. The API requires the original dictionary. A constructed control completes with three wrong output bytes despite both checks passing: a designed collision, not a failure-rate estimate or codec defect. Bind exact dictionary and intended output to trusted metadata; a digest needs a trusted reference. [zlib-rfc1950] [zlib-dictionary-api] [hesela-zlib-evidence]",
  "related": [
    "zstandard",
    "backup-manifest",
    "restore-test",
    "cryptographic-hash",
    "zstandard-dictionary-id",
    "lz4-frame",
    "block-independent-compression",
    "virtual-executable-archive",
    "lossless-compression",
    "fsst",
    "re-pair",
    "tunstall-coding",
    "byte-pair-encoding",
    "lz78",
    "lzw",
    "adler-32"
  ],
  "citations": [
    {
      "id": "zstd-api",
      "title": "Zstandard v1.5.7 API manual: dictionary identification and decompression",
      "url": "https://github.com/facebook/zstd/blob/v1.5.7/doc/zstd_manual.html",
      "accessed": "2026-10-17"
    },
    {
      "id": "hesela-zstd",
      "title": "Hesela: Compressed archives, dictionary dependencies and validation coverage",
      "url": "https://hesela.com/analyses/compressed-archives-dictionary-dependencies/",
      "accessed": "2026-10-17"
    },
    {
      "id": "lz4-api",
      "title": "LZ4 v1.9.4 frame API: dictionary identification and memory lifetime",
      "url": "https://github.com/lz4/lz4/blob/v1.9.4/lib/lz4frame.h",
      "accessed": "2026-10-22"
    },
    {
      "id": "lz4-implementation",
      "title": "LZ4 v1.9.4 implementation: frame Dict-ID parsing and LZ4F_decompress_usingDict",
      "url": "https://github.com/lz4/lz4/blob/v1.9.4/lib/lz4frame.c",
      "accessed": "2026-10-22"
    },
    {
      "id": "hesela-lz4",
      "title": "Hesela: LZ4 frame checks, dictionary selection and completion",
      "url": "https://hesela.com/analyses/lz4-frame-checks-block-order/",
      "accessed": "2026-10-22"
    },
    {
      "id": "zlib-rfc1950",
      "title": "RFC 1950: zlib DICTID, decoded Adler-32 and checksum recurrence, sections 2.2 and 9",
      "url": "https://www.rfc-editor.org/rfc/rfc1950",
      "accessed": "2026-11-03"
    },
    {
      "id": "zlib-dictionary-api",
      "title": "zlib 1.3.1 manual: deflateSetDictionary and inflateSetDictionary",
      "url": "https://zlib.net/manual.html",
      "accessed": "2026-11-03"
    },
    {
      "id": "hesela-zlib-evidence",
      "title": "Hesela: eight designed zlib dictionary checksum controls, frozen inputs and replay",
      "url": "https://hesela.dev/research/zlib-dictionary-alias/README.md",
      "accessed": "2026-11-03"
    }
  ],
  "provenance": [
    "Separate raw-content and formatted-dictionary experiments use deliberate dependency mutations on one CLI build, not a measured field-failure rate or naturally occurring ID/hash collision.",
    "The LZ4 supplement is a distinct one-build API experiment; its Dict-ID behavior must not be inferred from Zstandard's formatted-dictionary checks.",
    "A separate 16-case two-block lifecycle supplement deliberately replaces an argument or mutates retained bytes. Allocations remain live; no use-after-free, concurrency, performance or field-rate result is claimed.",
    "Ten synthetic multi-frame controls use the same dictionary across data frames; skipped metadata is outside the payload-only acceptance rule. No cross-dictionary switching or wrapper-wide behavior is inferred.",
    "The zlib supplement retains an unchanged 45-byte stream and a deliberately checksum-preserving dictionary substitution. Eight controls run through C, Python and Node; these are not independent random trials, and C/Python use the same system library."
  ]
}
