CDX
chemical/x-cdx
Magic Bytes
Offset: 0
56 6A 43 44 30 31 30 30
ChemDraw Exchange (CDX) is a proprietary binary file format developed by CambridgeSoft and maintained by PerkinElmer for encoding chemical structures and metadata. Scientists and researchers utilize this format to store molecular geometry, reaction schemes, and biochemical drawings within the ChemDraw software suite. Although largely superseded by the XML-based CDXML format for modern interoperability, CDX is considered a safe, compact legacy format primarily used for the archival storage of complex chemical data.
Validation Code
How to validate .cdx files in Python
Python
def is_cdx(file_path: str) -> bool:
"""Check if file is a valid CDX by magic bytes."""
signature = bytes([0x56, 0x6A, 0x43, 0x44, 0x30, 0x31, 0x30, 0x30])
with open(file_path, "rb") as f:
return f.read(8) == signature
How to validate .cdx files in Node.js
Node.js
function isCDX(buffer: Buffer): boolean {
const signature = Buffer.from([0x56, 0x6A, 0x43, 0x44, 0x30, 0x31, 0x30, 0x30]);
return buffer.subarray(0, 8).equals(signature);
}
Go
func IsCDX(data []byte) bool {
signature := []byte{0x56, 0x6A, 0x43, 0x44, 0x30, 0x31, 0x30, 0x30}
if len(data) < 8 {
return false
}
return bytes.Equal(data[:8], signature)
}
API Endpoint
GET
/api/v1/cdx
curl https://filesignature.org/api/v1/cdx