Windows
image/bmp
Magic Bytes
Offset: 0
42 4D
Device Independent Bitmap (DIB) is a raster image format developed by Microsoft Corporation to store bitmap data independently of specific display hardware. It is primarily utilized within legacy Windows API operations and memory management to ensure consistent color and resolution across diverse output devices. While largely superseded by modern BMP standards and compressed alternatives, the DIB remains a secure, non-executable format with minimal risk of malware transmission or structural exploitation.
Validation Code
How to validate .dib files in Python
Python
def is_dib(file_path: str) -> bool:
"""Check if file is a valid DIB by magic bytes."""
signature = bytes([0x42, 0x4D])
with open(file_path, "rb") as f:
return f.read(2) == signature
How to validate .dib files in Node.js
Node.js
function isDIB(buffer: Buffer): boolean {
const signature = Buffer.from([0x42, 0x4D]);
return buffer.subarray(0, 2).equals(signature);
}
Go
func IsDIB(data []byte) bool {
signature := []byte{0x42, 0x4D}
if len(data) < 2 {
return false
}
return bytes.Equal(data[:2], signature)
}
API Endpoint
GET
/api/v1/dib
curl https://filesignature.org/api/v1/dib