Compressed archive file (.lzh)
.lzh file signature | application/x-lzh-compressed
LZH is a compressed archive file format associated with the Lempel-Ziv-Huffman family and originally developed by Haruyasu Yoshizaki for the LHarc archiver. It was used to distribute software, documents, and bundled files on Unix and Japanese systems, and some tools still extract it today. As a legacy format, it is largely obsolete, but archives can still appear in older software collections and should be handled cautiously from untrusted sources.
Magic Bytes
Offset 2
2D 6C 68 30 2D
Sources: Wikipedia
All Known Signatures
3 signature variants are documented for .lzh files across multiple sources.
| Hex Signature | Offset | Sources |
|---|---|---|
| 2D 6C 68 30 2D | 2 | Wikipedia |
| 2D 6C 68 35 2D | 2 | Wikipedia |
| 2D 6C 68 | 2 | Gary Kessler |
Extension
.lzh
MIME Type
application/x-lzh-compressed
Byte Offset
2
Risk Level
Safe
Validation Code
How to validate .lzh files in Python
def is_lzh(file_path: str) -> bool:
"""Check if file is a valid LZH by magic bytes at offset 2."""
signature = bytes([0x2D, 0x6C, 0x68, 0x30, 0x2D])
with open(file_path, "rb") as f:
f.seek(2)
return f.read(5) == signature
How to validate .lzh files in Node.js
function isLZH(buffer: Buffer): boolean {
const signature = Buffer.from([0x2D, 0x6C, 0x68, 0x30, 0x2D]);
if (buffer.length < 7) return false;
return buffer.subarray(2, 7).equals(signature);
}
How to validate .lzh files in Go
func IsLZH(data []byte) bool {
signature := []byte{0x2D, 0x6C, 0x68, 0x30, 0x2D}
if len(data) < 7 {
return false
}
return bytes.Equal(data[2:7], signature)
}
API Endpoint
/api/v1/lzh
curl https://filesignature.org/api/v1/lzh
See the full API documentation for all endpoints and parameters.
Related Formats
Frequently Asked Questions
What is a .lzh file?
A .lzh file is a Compressed archive file file. LZH is a compressed archive file format associated with the Lempel-Ziv-Huffman family and originally developed by Haruyasu Yoshizaki for the LHarc archiver. It was used to distribute software, documents, and bundled files on Unix and Japanese systems, and some tools still extract it today. As a legacy format, it is largely obsolete, but archives can still appear in older software collections and should be handled cautiously from untrusted sources.
What are the magic bytes for .lzh files?
The magic bytes for Compressed archive file files are 2D 6C 68 30 2D at byte offset 2. These bytes uniquely identify the file format regardless of the file extension.
How do I validate a .lzh file?
To validate a .lzh file, read the first bytes of the file and compare them against the known magic bytes (2D 6C 68 30 2D) at offset 2. This is more reliable than checking the file extension alone, as extensions can be renamed.
What is the MIME type for .lzh files?
The primary MIME type for .lzh files is application/x-lzh-compressed.
Is it safe to open .lzh files?
Compressed archive file (.lzh) files are generally safe to open. They are classified as low risk because they primarily contain data rather than executable code. However, always ensure files come from a trusted source.