LZ
application/x-lzip
Magic Bytes
Offset: 0
4C 5A 49 50
Lzip is a lossless data compression format designed by Antonio Diaz Diaz, utilizing the Lempel-Ziv-Markov chain Algorithm (LZMA) to reduce file sizes efficiently. It is frequently employed in Linux distributions for software packaging and data archiving due to its focus on data integrity and recovery capabilities. While the file structure itself is benign, compressed archives should be scanned before extraction to ensure they do not contain hidden malware or malicious scripts.
Validation Code
How to validate .lz files in Python
Python
def is_lz(file_path: str) -> bool:
"""Check if file is a valid LZ by magic bytes."""
signature = bytes([0x4C, 0x5A, 0x49, 0x50])
with open(file_path, "rb") as f:
return f.read(4) == signature
How to validate .lz files in Node.js
Node.js
function isLZ(buffer: Buffer): boolean {
const signature = Buffer.from([0x4C, 0x5A, 0x49, 0x50]);
return buffer.subarray(0, 4).equals(signature);
}
Go
func IsLZ(data []byte) bool {
signature := []byte{0x4C, 0x5A, 0x49, 0x50}
if len(data) < 4 {
return false
}
return bytes.Equal(data[:4], signature)
}
API Endpoint
GET
/api/v1/lz
curl https://filesignature.org/api/v1/lz