Jump to content
Setting up an AI agent? ReverseEngineering.wiki skill (works from the command line, no configuration): https://reverseengineering.wiki/skill/rewiki/SKILL.md · setup for every client, including MCP: https://reverseengineering.wiki/llms.txt · REWiki:Connect

Format:LZHAM

From ReverseEngineering.wiki
Format
On this wiki Facts · Code · Notes · Topics

Rich Geldreich's LZ77 + Huffman codec with very fast decompression and high ratio (public domain, lzham_codec): raw streams or a zlib-like wrapper whose CMF byte has method 14, used by some games and Unity/Steam tools.

Overview

LZHAM (public domain, repository richgel999/lzham_codec) targets LZMA-like ratios with faster decompression. API version constant LZHAM_DLL_VERSION is 0x1010 in the cited commit, and lzham_get_version() returns it. Unverified: a few game engines and asset pipelines embed it (look for the exports below).

Identification

  • Exports: lzham_get_version, lzham_compress_init/compress/compress_memory/compress_deinit, lzham_decompress_init/decompress/decompress_memory/decompress_deinit, and a miniz-like lzham_z_* family (lzham_z_deflateInit2, lzham_z_inflate, lzham_z_uncompress, lzham_z_version). lzham_z_version returns "10.8.1" in this source.
  • Stream: raw LZHAM data has no magic. The lzham_z_* wrapper writes a zlib-style header with method 14 in the low nibble of CMF and (dictionary log2 - 15) in the high nibble: a 16 MiB window gives CMF 0x9E, 64 KiB gives 0x1E; see Fact:LZHAM/magic/zlib-style header CMF. A normal Format:Zlib stream uses method 8 (0x78).
  • Dictionary size is 2^15 to 2^26 (x86) or 2^29 (x64) bytes. The decoder must be given the same dictionary size log2 that the compressor used, because raw streams do not store it.

Code & repositories

  • https://github.com/richgel999/lzham_codec @ d379b1f9121e2197881c61cfc4713c78848bdfe7 · license: LicenseRef-Public-Domain (declared by the contributor; GitHub's detector did not recognize LICENSE)
    Reference LZHAM compressor/decompressor, public domain; lzham.h documents the API and limits.
    Tested on: source read, not run: source read · checked 2026-10-18; last activity 2023-01-17

See also

Technique:Identifying compression libraries in binaries, Format:LZMA, Format:DEFLATE