Virtual PC Virtual HD imagedynamic disk header
application/octet-stream
Magic Bytes
Offset: 0
63 6F 6E 65 63 74 69 78
The Virtual Hard Disk (VHD) format is a disk image file structure originally developed by Connectix for Virtual PC and later maintained by Microsoft. It is primarily used to store virtual machine hard disks, facilitate system backups, and allow operating systems to mount disk images as local drives. Although largely succeeded by the VHDX format in modern environments, VHD remains widely supported for legacy virtualization compatibility and is safe for storage and transfer.
Validation Code
How to validate .vhd files in Python
Python
def is_vhd(file_path: str) -> bool:
"""Check if file is a valid VHD by magic bytes."""
signature = bytes([0x63, 0x6F, 0x6E, 0x65, 0x63, 0x74, 0x69, 0x78])
with open(file_path, "rb") as f:
return f.read(8) == signature
How to validate .vhd files in Node.js
Node.js
function isVHD(buffer: Buffer): boolean {
const signature = Buffer.from([0x63, 0x6F, 0x6E, 0x65, 0x63, 0x74, 0x69, 0x78]);
return buffer.subarray(0, 8).equals(signature);
}
Go
func IsVHD(data []byte) bool {
signature := []byte{0x63, 0x6F, 0x6E, 0x65, 0x63, 0x74, 0x69, 0x78}
if len(data) < 8 {
return false
}
return bytes.Equal(data[:8], signature)
}
API Endpoint
GET
/api/v1/vhd
curl https://filesignature.org/api/v1/vhd