Skip to main content

is_macbinary

Function is_macbinary 

Source
pub fn is_macbinary(bytes: &[u8]) -> Option<MacBinaryVersion>
Expand description

Classify bytes as MacBinary using the confidence-scored §2.4 heuristic. Returns the identified version, or None.

The floor (all required): byte $00/$52/the 8 reserved at $6C are zero; filename length 1..=63 with printable Mac-Roman bytes; fork lengths each <= 0x7FFFFF with at least one nonzero; type/creator each four printable bytes or all-zero. Then escalate: 'mBIN' → III (certain); valid CRC → II (certain); otherwise accept as I only when the padded size matches exactly (conservative, to avoid hijacking an unrelated .bin).