BIB
application/x-bibtex-text-file
Magic Bytes
Offset: 0
25 20 42 69 62 54 65 58 20 60
BibTeX is a bibliographic data management format created by Oren Patashnik and Leslie Lamport for the LaTeX document preparation system. It serves as a structured text database for organizing citation metadata, including authors, titles, and publication dates, within academic and scientific research. Although legacy in comparison to modern BibLaTeX extensions, this non-executable format remains a foundational standard in publishing and presents minimal security risks when processed by standard typesetting engines.
Validation Code
How to validate .bib files in Python
Python
def is_bib(file_path: str) -> bool:
"""Check if file is a valid BIB by magic bytes."""
signature = bytes([0x25, 0x20, 0x42, 0x69, 0x62, 0x54, 0x65, 0x58, 0x20, 0x60])
with open(file_path, "rb") as f:
return f.read(10) == signature
How to validate .bib files in Node.js
Node.js
function isBIB(buffer: Buffer): boolean {
const signature = Buffer.from([0x25, 0x20, 0x42, 0x69, 0x62, 0x54, 0x65, 0x58, 0x20, 0x60]);
return buffer.subarray(0, 10).equals(signature);
}
Go
func IsBIB(data []byte) bool {
signature := []byte{0x25, 0x20, 0x42, 0x69, 0x62, 0x54, 0x65, 0x58, 0x20, 0x60}
if len(data) < 10 {
return false
}
return bytes.Equal(data[:10], signature)
}
API Endpoint
GET
/api/v1/bib
curl https://filesignature.org/api/v1/bib