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 time zones are added.
Links
Software
- 7-Zip, extract only (Windows)
- Lhasa, a free extractor (Linux, macOS, Windows)
- The Unarchiver (macOS)
Developers
- liblhasa, the C library behind Lhasa
- libarchive, C library that reads LHA archives