LHA (file format)

From Wikipedia, the free encyclopedia
Jump to: navigation, search
LHA
Filename extension .lzh, .lha
Internet media type application/x-lzh-compressed
Type code "LHA " (L-H-A-SPACE)
Uniform Type Identifier public.archive.lha
Developed by Haruyasu Yoshizaki (Yoshi)
Type of format Data compression

LHA is a freeware compression utility and associated file format. It was created in 1988 by Haruyasu Yoshizaki (吉崎栄泰 Yoshizaki Haruyasu?), and originally named LHarc. A complete rewrite of LHarc, tentatively named LHx, was eventually released as LH. It was then renamed to LHA to avoid conflicting with the then-new MS-DOS 5.0 LH ("load high") command. According to early documentation, LHA is pronounced like La.

Although no longer much used in the West, LHA remains popular in Japan. It was used by id Software to compress installation files for their earlier games, including Doom and Quake. LHA has been ported to many operating systems, and is still the main archiving format used on the Amiga computer, although it competed with LZX in the mid 90s. This was due to Aminet, the world's largest archive of Amiga related software and files, standardising on Stefan Boberg's implementation of LHA for the Amiga. Microsoft has released a Windows XP add-on, Microsoft Compressed (LZH) Folder Add-on, designed for the Japanese version of the operating system.[1][2] The Japanese version of Windows 7 ships with the LZH folder add-on built-in.[3] Users of non-Japanese versions of Windows 7 Enterprise and Ultimate can also install the LZH folder add-on by installing the optional Japanese language pack from Windows Update.

Compression methods[edit]

In an LZH archive, the compression method is stored as a 5-byte text string. These are the third through seventh bytes of the file.

Canonical LZH[edit]

LHarc compresses files using an algorithm from Yoshizaki's earlier LZHUF product, which was modified from LZARI developed by Haruhiko Okumura (奥村晴彦 Okumura Haruhiko?), but uses Huffman coding instead of arithmetic coding. LZARI uses Lempel–Ziv–Storer–Szymanski with arithmetic coding.

-lh0-[edit]

No compression method is applied to the source data.

-lh1-[edit]

This method is introduced in LHarc version 1.

It supports 4KiByte sliding window, with support of maximum 60 bytes of matching length. Dynamic Huffman encoding is used.

-lh4-, -lh5-, -lh6, -lh7-[edit]

Methods 4, 5, 6, 7 support 4, 8, 32, 64 KiByte sliding window respectively, with support of maximum 256 bytes of matching length. Static Huffman encoding is used. lh5 is first introduced in LHarc 2, followed by lh6 in LHA 2.66 (MSDOS), lh7 in LHA 2.67 beta (MSDOS). LHA itself never compresses into lh4.

-lhd-[edit]

Technically it is not a compression method, but it is used in .LZH archive to indicate the compressed object is an empty directory.

Joe Jared extensions[edit]

Joe Jared extended LZSS to use larger dictionaries.

-lh8-, -lh9-, -lha-, -lhb-, -lhc-, -lhe-[edit]

Dictionary sizes are 64, 128, 256, 512, 1024, 2048 Ki bytes respectively.

UNLHA32 extensions[edit]

UNLHA32.DLL uses its own method for testing purposes.

-lhx-[edit]

It uses 128-256 Ki bytes dictionary.

PMarc extensions[edit]

These compression methods are created by PMarc, an CP/M archiver created by Miyo. The archive usually has a .PMA extension.

-pc1-[edit]

PopCom compressed executable archive.

-pm0-[edit]

No compression method is applied to the source data.

-pm1-[edit]

-pm2-[edit]

-pms-[edit]

Used to indicate PMarc self-extracting archive.

LArc extensions[edit]

LArc uses the same file format as .LZH, but was written by Kazuhiko Miki, Haruhiko Okumura, Ken Masuyama, with extension name '.LZS'.[1]

-lzs-[edit]

It supports 2KiByte sliding window, with support of maximum 17 bytes of matching length.

-lz2-[edit]

It is similar of -lzs-, except dictionary size and match length can be changed.

-lz3-[edit]

-lz4-[edit]

No compression method is applied to the source data.

-lz5-[edit]

It supports 4KiByte sliding window, with support of maximum 17 bytes of matching length.

-lz7-[edit]

-lz8-[edit]

LHICE/ICE[edit]

There are copies of LHICE marked as version 1.14. According to Okumura, LHICE is not written by Yoshi.[4]

See also[edit]

References[edit]

External links[edit]