CDB
application/octet-stream
Magic Bytes
Offset: 0
0D F0 1D C0
The Constant Database (CDB) is an immutable associative array format created by D. J. Bernstein for fast, disk-based lookups. It is extensively used within Unix-like operating systems, particularly by mail transfer agents such as qmail and Postfix, to store configuration maps and alias databases. Designed for high reliability and protection against database corruption, the format is read-only and remains a secure choice for static data storage without posing any inherent security risks.
Validation Code
How to validate .cdb files in Python
Python
def is_cdb(file_path: str) -> bool:
"""Check if file is a valid CDB by magic bytes."""
signature = bytes([0x0D, 0xF0, 0x1D, 0xC0])
with open(file_path, "rb") as f:
return f.read(4) == signature
How to validate .cdb files in Node.js
Node.js
function isCDB(buffer: Buffer): boolean {
const signature = Buffer.from([0x0D, 0xF0, 0x1D, 0xC0]);
return buffer.subarray(0, 4).equals(signature);
}
Go
func IsCDB(data []byte) bool {
signature := []byte{0x0D, 0xF0, 0x1D, 0xC0}
if len(data) < 4 {
return false
}
return bytes.Equal(data[:4], signature)
}
API Endpoint
GET
/api/v1/cdb
curl https://filesignature.org/api/v1/cdb