VHDX
application/octet-stream
Magic Bytes
Offset: 0
76 68 64 78 66 69 6C 65
The Virtual Hard Disk v2 (VHDX) is a disk image file format developed by Microsoft for its Hyper-V virtualization software. It serves as a container for virtualized hard disks, storing operating systems and application data for virtual machines or system backups. As the successor to the original VHD format, it provides corruption resiliency; however, administrators must scan the contents for malware as the container itself only protects the disk structure.
Validation Code
How to validate .vhdx files in Python
Python
def is_vhdx(file_path: str) -> bool:
"""Check if file is a valid VHDX by magic bytes."""
signature = bytes([0x76, 0x68, 0x64, 0x78, 0x66, 0x69, 0x6C, 0x65])
with open(file_path, "rb") as f:
return f.read(8) == signature
How to validate .vhdx files in Node.js
Node.js
function isVHDX(buffer: Buffer): boolean {
const signature = Buffer.from([0x76, 0x68, 0x64, 0x78, 0x66, 0x69, 0x6C, 0x65]);
return buffer.subarray(0, 8).equals(signature);
}
Go
func IsVHDX(data []byte) bool {
signature := []byte{0x76, 0x68, 0x64, 0x78, 0x66, 0x69, 0x6C, 0x65}
if len(data) < 8 {
return false
}
return bytes.Equal(data[:8], signature)
}
API Endpoint
GET
/api/v1/vhdx
curl https://filesignature.org/api/v1/vhdx