Introduction
LHA, first called LHarc, is an archiver that Haruyasu Yoshizaki wrote for MS-DOS in
1988 and gave away with its source code. Its archives, named .lzh or
.lha, became the usual archive format in Japan and on the Amiga, and were
common on bulletin boards elsewhere. Many DOS and Amiga games and demos are still found
in this form, and some game data and firmware files use it inside.
Structure
An archive is a series of entries, each a header followed by the compressed file, and ends with a zero byte. There is no archive header and no central list. Numbers are little-endian.
0Header size and, in older header levels, a header checksum2 bytes2Method ID five characters such as-lh5-5 bytes7Sizes, time, attribute and header level then the name, CRC-16 and extended headersvaries…Compressed data, then the next entry’s headervaries
The method ID names the compression: -lh0- is stored,
-lh1- is the original LHarc method, and -lh5-,
-lh6- and -lh7- use LZSS with Huffman coding and windows of
8, 32 and 64 KB. -lhd- marks a folder. Headers come in levels 0, 1, 2 and 3,
which differ in where the name is stored and how extended headers for long names,
Unix permissions and times are added. Every level, extended header, method and OS ID
is on the headers and codes page.
Not described
Re-checked on 2026-11-13 against header.doc.md and Lhasa’s source.
Known, not yet covered
- Reference: the PMarc methods
-pm0-,-pm1-,-pm2-(Lhasa’spm1_decoder.c,pm2_decoder.c) and the LHARK-lk7-and Unlha32-lhx-variants of the new-style coder. - Reference: the platform-specific extended headers that Lhasa decodes only in part: the
OS-9 header (
CC, only the permissions are read) and the data Unix and OS/2 writers put in the common header.
Unknown
- Reference: the layout of extended header types
39(multi-disc) and40, and of the further types other platform ports defined (such as7Dto7FandFF): none of them is in a source read.
Links
Software
- 7-Zip – free archiver that extracts LHA archives (Windows)
- Lhasa – free command-line extractor (Linux, macOS, Windows)
- The Unarchiver – free extractor for many formats (macOS)
Developers
- liblhasa – the library behind Lhasa (C)
- libarchive – reads LHA archives among many formats (C)