HDF5

application/octet-stream

Safe

Magic Bytes

Offset: 0
89 48 44 46 0D 0A 1A 0A

Hierarchical Data Format version 5 (HDF5) is an open-source file format and library suite maintained by The HDF Group for storing and managing complex data. It is extensively utilized in scientific research, engineering, and high-performance computing to organize large, heterogeneous datasets and multidimensional arrays efficiently. Designed as a flexible successor to earlier HDF standards, the format serves as a robust container that poses minimal security risks during standard data processing.

Extension

.hdf5

MIME Type

application/octet-stream

Byte Offset

0

Risk Level

Safe

Validation Code

How to validate .hdf5 files in Python

Python
def is_hdf5(file_path: str) -> bool:
    """Check if file is a valid HDF5 by magic bytes."""
    signature = bytes([0x89, 0x48, 0x44, 0x46, 0x0D, 0x0A, 0x1A, 0x0A])
    with open(file_path, "rb") as f:
        return f.read(8) == signature

How to validate .hdf5 files in Node.js

Node.js
function isHDF5(buffer: Buffer): boolean {
  const signature = Buffer.from([0x89, 0x48, 0x44, 0x46, 0x0D, 0x0A, 0x1A, 0x0A]);
  return buffer.subarray(0, 8).equals(signature);
}
Go
func IsHDF5(data []byte) bool {
    signature := []byte{0x89, 0x48, 0x44, 0x46, 0x0D, 0x0A, 0x1A, 0x0A}
    if len(data) < 8 {
        return false
    }
    return bytes.Equal(data[:8], signature)
}

API Endpoint

GET /api/v1/hdf5
curl https://filesignature.org/api/v1/hdf5

Related Formats