LHA

From Just Solve the File Format Problem
(Difference between revisions)
Jump to: navigation, search
(Compression schemes: not in use)
(Compression schemes)
Line 21: Line 21:
  
 
=== Compression schemes ===
 
=== Compression schemes ===
Wikipedia has a [[Wikipedia:LHA (file format)#Compression methods|list of LHA compression methods]], as identified by the alphanumeric bytes of the ''compression method'' field. It includes the following:
+
The compression scheme of an element is identified by the alphanumeric bytes of its ''compression method'' field. Known compression schemes:
lh0, lh1, <s>lh2</s>, <s>lh3</s>, lh4, lh5, lh6, lh7, lh8, lh9,
+
lha, lhb, lhc, lhd, lhe, lhx,
+
lz2, lz3, lz4, lz5, lz7, lz8, lzs,
+
pc1, pm0, pm1, pm2, pms
+
  
<code>lhd</code> is not actually a compression scheme, but indicates that the element represents a subdirectory.
+
{| class="wikitable"
 +
! ID !! Category !! Description and remarks
 +
|-
 +
|<code>lh0</code> || || Uncompressed
 +
|-
 +
|<code>lh1</code> || ||
 +
|-
 +
|<code>lh2</code> || ||rowspan="2"| (Not in use?)
 +
|-
 +
|<code>lh3</code>
 +
|-
 +
|<code>lh4</code> || ||
 +
|-
 +
|<code>lh5</code> || ||
 +
|-
 +
|<code>lh6</code> || ||
 +
|-
 +
|<code>lh7</code> || ||
 +
|-
 +
|<code>lh8</code> ||rowspan="5"| Joe Jared extensions ||
 +
|-
 +
|<code>lh9</code> ||
 +
|-
 +
|<code>lha</code> ||
 +
|-
 +
|<code>lhb</code> ||
 +
|-
 +
|<code>lhc</code> ||
 +
|-
 +
|<code>lhd</code> || Special || Not a compression scheme. Indicates that the element represents a subdirectory
 +
|-
 +
|<code>lhe</code> || Joe Jared extensions ||
 +
|-
 +
|<code>lhx</code> || UNLHA32 extension ||
 +
|-
 +
|<code>lz2</code> ||rowspan="7"| LArc extensions ||
 +
|-
 +
|<code>lz3</code> ||
 +
|-
 +
|<code>lz4</code> ||
 +
|-
 +
|<code>lz5</code> ||
 +
|-
 +
|<code>lz7</code> ||
 +
|-
 +
|<code>lz8</code> ||
 +
|-
 +
|<code>lzs</code> ||
 +
|-
 +
|<code>pc1</code> ||rowspan="5"| PMarc extensions ||rowspan="5"| Refer to [[PMA]].
 +
|-
 +
|<code>pm0</code>
 +
|-
 +
|<code>pm1</code>
 +
|-
 +
|<code>pm2</code>
 +
|-
 +
|<code>pms</code>
 +
|}
 +
 
 +
The Wikipedia article has [[Wikipedia:LHA (file format)#Compression methods|more information]] about some of the schemes.
  
 
=== Extended headers ===
 
=== Extended headers ===

Revision as of 14:57, 24 May 2020

File Format
Name LHA
Ontology
Extension(s) .lha, .lzh, .lzs
MIME Type(s) application/x-lzh-compressed
PRONOM fmt/626
Kaitai Struct Spec lzh.ksy
Released 1988

LHA is an archiving program and file format created by Haruyasu Yoshizaki in 1988. It was originally called LHarc, then was briefly LH before settling on LHA. In the 1990s, it was the most popular archiving format on the Amiga platform. It also got some use on the PC platform including in the installers for id Software games such as Doom and Quake, because ZIP compression was inferior until the release of PKZIP 2.0, which brought the formats to parity. At present, it is mostly used in Japan.

The file format is also known as LZH. See the LZH disambiguation page for other "LZH" formats.

Contents

Format details

An LHA file consists of a sequence of elements, each representing a member file or directory. There is no global archive-level header.

There are at least four different formats that an element can have. (Note that this is independent of compression schemes.) In LHA jargon, the formats are known as "header levels", and are usually called "header level 0", "... 1", "... 2", and "... 3".

The format of an element is determined by the byte at offset 20 from the beginning of that element. It is possible for different formats to be used in the same LHA file.

The formats are similar, but irritatingly different. They don't even follow the same principles with respect to how they must be parsed.

Compression schemes

The compression scheme of an element is identified by the alphanumeric bytes of its compression method field. Known compression schemes:

ID Category Description and remarks
lh0 Uncompressed
lh1
lh2 (Not in use?)
lh3
lh4
lh5
lh6
lh7
lh8 Joe Jared extensions
lh9
lha
lhb
lhc
lhd Special Not a compression scheme. Indicates that the element represents a subdirectory
lhe Joe Jared extensions
lhx UNLHA32 extension
lz2 LArc extensions
lz3
lz4
lz5
lz7
lz8
lzs
pc1 PMarc extensions Refer to PMA.
pm0
pm1
pm2
pms

The Wikipedia article has more information about some of the schemes.

Extended headers

For header levels 1 and higher, each member file has an associated list of "extended headers", similar to ZIP's extensible data fields. Each extended header is tagged with a single byte indicating its type. Extended headers are used to store platform-specific metadata, and to extend the format in other ways.

Header level 0 supports extended data in a more limited way. It allows for just one set of extended header fields (called the "extended area"), the content of which is determined by the initial one-byte "OS type" field.

Identification

Bytes '-' 'l' ?? ?? '-' appear at offset 2. This is not a global file signature, but represents the compression scheme of the first member file of the archive.

If you consider PMA to be a form of LHA, then the second of these bytes can also be 'p'.

See also

Format documentation

Software

Sample files

Other links

Personal tools
Namespaces

Variants
Actions
Navigation
Toolbox