Liner Notes

issue No. 63

the stories behind the reference — one a day

Side ATrack no. 63

Story

The PNG header, an eight-byte tripwire

Most file signatures simply announce what a file is. The PNG header does that and something cleverer: it checks whether the file survived the journey to reach you. Its eight opening bytes are not chosen for looks. They are an engineered tripwire, each part placed to catch a specific way that files used to get quietly damaged in transit, back when moving a file meant passing it through systems that felt free to meddle.

Consider what those bytes are watching for. The very first byte has its high bit set, a value that plain seven-bit email systems could not carry cleanly; if such a system mangled the file, that byte would arrive wrong, and the damage would show. Next comes a carriage-return and line-feed pair, positioned to catch the old habit of translating line endings between systems, a well-meaning conversion that would corrupt binary data without warning. And there is a particular byte, the one written as 1a, that stops the DOS type command dead, halting it before it could spill the file's raw bytes across a terminal. Each element guards against a different, real hazard of its era.

The elegance is that the header does double duty. It identifies the file as a PNG, and it certifies the file's integrity in the same eight bytes. If a PNG survived transfer intact, its signature proves it, because any of the old corruptions would have altered one of those carefully chosen bytes and given the damage away. A clean signature is therefore not just a name tag but a receipt, evidence that the file made it through unharmed. The exhibit's sniffer reads these bytes locally, off your own machine, and shows you the header sitting at the front of any PNG you offer it. What looks like an arbitrary run of characters turns out to be a small, deliberate machine for detecting harm, built by people who had watched too many files arrive broken and decided the file itself should be able to tell you it had not.

Meanwhile, across the desk

Read one every morning

A new exhibit prints here each day, drawn from the network's lore. Set Liner Notes as your homepage and read it with your coffee.

Make it your homepage

Liner Notes · No. 63 ·