Also known as .hqx, .hcx, .hex, BinHex Binary Text
BinHex, originally short for "binary-to-hexadecimal", is a binary-to-text encoding system which was used on the classic Mac OS for sending binary files over email. BinHexed files take up more space than the original files, but avoid data corruption by software that is not 8-bit clean.
BINHEX – Obsolete Thor
preservation.tylerthorsted.com →Picking the right encoding was critical to getting the content transferred correctly, this was even more critical when working with Macintosh files which needed a resource fork and/or finder attributes to work properly. In those cases a MacBinary or BinHex file was required! Fetch would automatically identify those formats and decode them for you. One format I didn’t spend much if any time on is the BinHex format . BinHex was a format born out of necessity to move files back and forth across the World Web Web, bulletin boards, AOL, Compuserve, and the like. The FTP program Fetch glossary describes BinHex as: punctuation. Because BinHex files are simply text, they can be sent through most electronic mail systems and stored on most computers. However the conversion to text makes the file larger, so it takes longer to transmit a file in BinHex format than if the file was represented some other way. You can still find many of these HQX files floating around the interwebs and on older CDs from the 1990’s. One such CD recently came into my possession. I managed to get a copy of the book “Internet File Formats “, by Tim Kientzie. It came with a CD-ROM with lots of goodies included. Some sample files, specifications, and software. The disc itself is an ISO 9660 partitioned disc, but includes a few Macintosh formats, so the author put many of the software files in the HQX format to maintain the much needed resource fork Macintosh applications need in order to run. Since BINHEX files are encoded as text, lets take a look at a couple of these from the disc which didn’t identify. That “Value” listed in hexadecimal decodes to: “(This file must be converted with BinHex” as listed in the description. We can see this line in the file above, but the signature assumes the value begins at offset 0 from the beginning of the file. So its looking for that value at the start of the file, but this file seems to have some additional text before the value. What does the specs say? We also learn a couple interesting things. The first character of the first line after the string should be a “:” and the last line should end with a “:” as well. That could help make the signature more solid. We also learn there are a maximum of 64 characters per line. The last line will probably not have full maximum, but the previous lines should…. I wonder if we could use this fixed position from the initial “:” to add even more strength to the signature. Adding the 4,084 bytes at the beginning allow for additional text. This value worked for my samples but there could be others out there with more. The {6-9} bytes in between the string and the colon account for the various way newlines are encoded. Sometimes is one “0A” byte, other times it is “OD”, and others its both. After testing, adding values in the signature to account for the 64 byte line can fail if the file has only one line, so I left it out. The EOF should just be the colon (3A), but I found many of my samples had various line endings and other random characters. Hence the 64 bytes for max offset. Hopefully this update will add some strength to the signature and follow the specification closer. The new signature even works on files with extra content at the beginning! Oh, and also, the CD-ROM I mentioned earlier has a few “fun” features. Not sure if they are on purpose or if errors were made during mastering, but a few filenames have some hidden extra characters and one folder puts any tool traversing the directory into a loop, even droid. Have fun! Save my name, email, and website in this browser for the next time I comment.
~5 min read
BinHex, originally short for "binary-to-hexadecimal", is a binary-to-text encoding system which was used on the classic Mac OS for sending binary files over email. BinHexed files take up more space than the original files, but avoid data corruption by software that is not 8-bit clean.
== History ==
Excerpt from a page describing this subject · 8,795 chars · not written by Vinony
via Wikidata · CC0
Discovered by embedding cosine similarity (sentence-transformers MiniLM, 384-dim).