ONETOC
application/onenote;format=onetoc2
Magic Bytes
Offset: 0
43 FF 2F A1
ONETOC is a proprietary binary file format developed by Microsoft for managing the structure of notebook folders within Microsoft OneNote. It functions as a table of contents that tracks the arrangement and hierarchy of individual section files, facilitating navigation across complex document collections. This format is primarily associated with local notebook storage and legacy versions of the software, as modern cloud-based iterations typically utilize different internal synchronization mechanisms.
Validation Code
How to validate .onetoc files in Python
Python
def is_onetoc(file_path: str) -> bool:
"""Check if file is a valid ONETOC by magic bytes."""
signature = bytes([0x43, 0xFF, 0x2F, 0xA1])
with open(file_path, "rb") as f:
return f.read(4) == signature
How to validate .onetoc files in Node.js
Node.js
function isONETOC(buffer: Buffer): boolean {
const signature = Buffer.from([0x43, 0xFF, 0x2F, 0xA1]);
return buffer.subarray(0, 4).equals(signature);
}
Go
func IsONETOC(data []byte) bool {
signature := []byte{0x43, 0xFF, 0x2F, 0xA1}
if len(data) < 4 {
return false
}
return bytes.Equal(data[:4], signature)
}
API Endpoint
GET
/api/v1/onetoc
curl https://filesignature.org/api/v1/onetoc