ODFT
application/vnd.oasis.opendocument.formula-template
Magic Bytes
Offset: 0
50 4B
The OpenDocument Formula Template (ODFT) is an XML-based file format maintained by OASIS for defining mathematical equations and formulas. This format serves as a reusable blueprint within office productivity suites like LibreOffice and Apache OpenOffice to ensure consistent formatting across multiple documents. While the format itself is considered safe, it utilizes a ZIP-compressed structure that requires office applications to implement proper security measures when parsing internal XML components and metadata.
Validation Code
How to validate .odft files in Python
Python
def is_odft(file_path: str) -> bool:
"""Check if file is a valid ODFT by magic bytes."""
signature = bytes([0x50, 0x4B])
with open(file_path, "rb") as f:
return f.read(2) == signature
How to validate .odft files in Node.js
Node.js
function isODFT(buffer: Buffer): boolean {
const signature = Buffer.from([0x50, 0x4B]);
return buffer.subarray(0, 2).equals(signature);
}
Go
func IsODFT(data []byte) bool {
signature := []byte{0x50, 0x4B}
if len(data) < 2 {
return false
}
return bytes.Equal(data[:2], signature)
}
API Endpoint
GET
/api/v1/odft
curl https://filesignature.org/api/v1/odft