H5
application/x-hdf
Magic Bytes
Offset: 0
0E 03 13 01
Hierarchical Data Format version 5 (HDF5) is a file format and library maintained by The HDF Group designed to store and organize large amounts of numerical data. It is extensively used in high-performance computing, scientific research, and engineering to handle complex, heterogeneous datasets and associated metadata. This format serves as a robust successor to HDF4, addressing previous limitations regarding file size and object counts to facilitate efficient cross-platform data exchange.
Validation Code
How to validate .h5 files in Python
Python
def is_h5(file_path: str) -> bool:
"""Check if file is a valid H5 by magic bytes."""
signature = bytes([0x0E, 0x03, 0x13, 0x01])
with open(file_path, "rb") as f:
return f.read(4) == signature
How to validate .h5 files in Node.js
Node.js
function isH5(buffer: Buffer): boolean {
const signature = Buffer.from([0x0E, 0x03, 0x13, 0x01]);
return buffer.subarray(0, 4).equals(signature);
}
Go
func IsH5(data []byte) bool {
signature := []byte{0x0E, 0x03, 0x13, 0x01}
if len(data) < 4 {
return false
}
return bytes.Equal(data[:4], signature)
}
API Endpoint
GET
/api/v1/h5
curl https://filesignature.org/api/v1/h5