SZ
application/x-snappy-framed
Magic Bytes
Offset: 0
73 4E 61 50 70 59
The SZ format is a compressed data stream utilizing the Snappy algorithm, originally developed by Google for rapid data processing. It is primarily employed in distributed systems, large-scale data processing frameworks like Apache Hadoop, and database systems requiring low-latency compression. While the format itself is considered safe and focuses on throughput over compression ratio, users should ensure that decompression libraries are updated to prevent potential buffer-related vulnerabilities during processing.
Validation Code
How to validate .sz files in Python
Python
def is_sz(file_path: str) -> bool:
"""Check if file is a valid SZ by magic bytes."""
signature = bytes([0x73, 0x4E, 0x61, 0x50, 0x70, 0x59])
with open(file_path, "rb") as f:
return f.read(6) == signature
How to validate .sz files in Node.js
Node.js
function isSZ(buffer: Buffer): boolean {
const signature = Buffer.from([0x73, 0x4E, 0x61, 0x50, 0x70, 0x59]);
return buffer.subarray(0, 6).equals(signature);
}
Go
func IsSZ(data []byte) bool {
signature := []byte{0x73, 0x4E, 0x61, 0x50, 0x70, 0x59}
if len(data) < 6 {
return false
}
return bytes.Equal(data[:6], signature)
}
API Endpoint
GET
/api/v1/sz
curl https://filesignature.org/api/v1/sz