ODF
application/vnd.oasis.opendocument.formula
Magic Bytes
Offset: 0
50 4B
OpenDocument Formula (ODF) is an XML-based file format maintained by OASIS for representing mathematical equations and formulas within the OpenDocument standard. It is primarily used by office suites like LibreOffice and Apache OpenOffice to store standalone formulas or embed mathematical expressions into documents and spreadsheets. The format is generally considered secure due to its ZIP-compressed XML structure, although software vulnerabilities in the processing application could theoretically be exploited by malformed container files.
Validation Code
How to validate .odf files in Python
Python
def is_odf(file_path: str) -> bool:
"""Check if file is a valid ODF by magic bytes."""
signature = bytes([0x50, 0x4B])
with open(file_path, "rb") as f:
return f.read(2) == signature
How to validate .odf files in Node.js
Node.js
function isODF(buffer: Buffer): boolean {
const signature = Buffer.from([0x50, 0x4B]);
return buffer.subarray(0, 2).equals(signature);
}
Go
func IsODF(data []byte) bool {
signature := []byte{0x50, 0x4B}
if len(data) < 2 {
return false
}
return bytes.Equal(data[:2], signature)
}
API Endpoint
GET
/api/v1/odf
curl https://filesignature.org/api/v1/odf