Formats

What lhasa reads — three format families, ten formats.

.lzh — LHA / LZH / LHarc (1988-)

The LHA format (originally LHarc) was created in 1988 by Haruyasu Yoshizaki (Y. Tagawa). It uses the LZARI / LZHUF algorithms (LZ77 + dynamic / static Huffman). The compression method is encoded in the filename suffix: -lh5- etc. Lhasa reads every LZH method:

SuffixAlgorithmNotes
-lh0- stored No compression. Header still records method.
-lh1- LZ77 + arithmetic (LZARI) Original LHarc method. Rare in the wild.
-lh4- LZ77 + static Huffman LZARI variant.
-lh5- LZHUF (LZ77 + dynamic Huffman) The default. What you'll most often encounter as .lzh today.
-lh6- Static-Huffman LZH variant Higher compression, narrower tool support.
-lh7- LZHUF + tree variant Experimental / rare.
-lhx- LZH compatibility marker Uses updated conventions + separate -lhd- directory header.

Beyond the compression method, lhasa handles the LZH header variants: level-0 / level-1 / level-2 headers (filename length, CRC, extended timestamps), the -lhd- directory-extension header, and MacBinary-encoded members.

Lhasa is decoder-only on the LZH family — it does not write new .lzh archives. For the write side, use the original jca02266/lha binary built from upstream source.

.lzs — LArc (1988-)

LArc is a separate archive tool by Haruhiko Okumura / Yoshizaki, contemporaneous with LHarc. Format-headers encode method as -lz5- / -lzs-. The data-compression kernel is also LZARI-based, but the format itself is structurally distinct from LHA (different magic, no filename-suffix method encoding).

Lhasa reads both the original LArc format and the modern -lz5- LZ5 method. The lib/lzs_decoder.c and lib/lz5_decoder.c in upstream are ~600 LoC each — small, well-tested.

.pma — PMarc (1989-)

PMarc is the LHA-family tool that was popular on Japanese NEC PC-98 machines in the late 1980s. Two methods (-pm1- / -pm2-) over a slightly different header layout. Same LZARI kernel underneath. Lhasa's lib/pm1_decoder.c and lib/pm2_decoder.c cover both. PC-98 software distribution archives (.pma files) are the canonical real-world use case.

The 0.6.0 release (2026-06-17) explicitly fixed a read overflow in the -pm2- decoder (NEWS) — "not believed to be an exploitable bug" per upstream, but a step worth calling out for security audits. See security audit.

MacBinary-encoded members

Inside an .lzh archive, individual members may carry MacBinary wrappers (MacLHA's signature feature — they encode the resource fork + data fork of an old Mac file as a single LZH member). Lhasa's lib/macbinary.c recognises and unwraps MacBinary members on extract.

What lhasa does not read