lzah only.Expand description
StuffIt classic compression method 5 (“LZAH”): LZSS sliding window over a pre-seeded 4 KiB dictionary, with a single adaptive (sibling- property) Huffman tree for literal/length tokens and a static canonical prefix code for the high bits of each match offset.
This is the raw method-5 fork payload — there is no StuffIt container
header here, exactly like the other archive-method codecs in this crate
(rar*, sit13, lha). A caller that walks a SIT! archive reads the per-
fork compressed bytes and the out-of-band uncompressed length from the
112-byte entry header, then hands the payload to this decoder.
§Method 5 vs method 13
The display name “LZAH” is used by some tools for two incompatible
classic StuffIt methods. This module implements method low-nibble 5
only (4 KiB window, MSB-first bits, one adaptive Huffman tree, fixed
window pre-seed). Method 13 is a different codec (64 KiB window, LSB-
first, transmitted prefix codes, in-band end-of-stream) handled by the
separate sit13 module. Always disambiguate on the numeric method byte.
§Framing — length is out of band
Method 5 has no in-band end-of-stream symbol; decoding stops exactly when
the declared uncompressed length has been produced. That length lives in
the archive entry header, not in the bitstream, so it is supplied through
DecoderConfig::with_len. A non-empty stream decoded with no length
(expected_len == None) cannot be terminated and is rejected with
Error::Unsupported.
§No encoder
No StuffIt method-5 encoder exists (the historical tooling is decode-only
and there is no modern need to write the format), so the Encoder
permanently returns Error::Unsupported.
§Licensing
Clean-room from a functional format description: the adaptive-Huffman mechanics, the window pre-seed pattern, the offset prefix-code length rule, and the container field offsets were implemented from a behavioural specification, not from any reference source code or lookup tables.
Structs§
- Decoder
- Streaming method-5 decoder.
- Decoder
Config - Decoder configuration: the out-of-band uncompressed length.
- Encoder
- Method-5 encoder stub: permanently returns
Error::Unsupported. - Lzah
- StuffIt classic method 5 (“LZAH”): LZSS + adaptive Huffman, decode-only.