Skip to content

H (.h)

.h file signature | text/x-chdr

Safe

Magic Bytes

Offset 0
23 69 66 6E 64 65 66 20

Sources: Apache Tika

Extension

.h

MIME Type

text/x-chdr

Byte Offset

0

Risk Level

Safe

Validation Code

How to validate .h files in Python

Python
def is_h(file_path: str) -> bool:
    """Check if file is a valid H by magic bytes."""
    signature = bytes([0x23, 0x69, 0x66, 0x6E, 0x64, 0x65, 0x66, 0x20])
    with open(file_path, "rb") as f:
        return f.read(8) == signature

How to validate .h files in Node.js

Node.js
function isH(buffer: Buffer): boolean {
  const signature = Buffer.from([0x23, 0x69, 0x66, 0x6E, 0x64, 0x65, 0x66, 0x20]);
  return buffer.subarray(0, 8).equals(signature);
}

How to validate .h files in Go

Go
func IsH(data []byte) bool {
    signature := []byte{0x23, 0x69, 0x66, 0x6E, 0x64, 0x65, 0x66, 0x20}
    if len(data) < 8 {
        return false
    }
    return bytes.Equal(data[:8], signature)
}

API Endpoint

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

See the full API documentation for all endpoints and parameters.

Frequently Asked Questions

What is a .h file?

A .h file is a H file.

What are the magic bytes for .h files?

The magic bytes for H files are 23 69 66 6E 64 65 66 20 at byte offset 0. These bytes uniquely identify the file format regardless of the file extension.

How do I validate a .h file?

To validate a .h file, read the first bytes of the file and compare them against the known magic bytes (23 69 66 6E 64 65 66 20) at offset 0. This is more reliable than checking the file extension alone, as extensions can be renamed.

What is the MIME type for .h files?

The primary MIME type for .h files is text/x-chdr.

Is it safe to open .h files?

H (.h) 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.