BinHex
BinHex
Main page

BinHex

logo
Community Hub0 subscribers
What are your thoughts?
Be the first to start a discussion here.
Be the first to start a discussion here.
BinHex

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 was originally written in 1981 by Tim Mann for the TRS-80 computer, as a standalone version of the encoding scheme of the popular terminal emulator ST80-III, for users of other terminals. It was used for sending files via major online services such as CompuServe which, not being 8-bit clean, required files to use ASCII armoring to survive. The system became very popular after Mann uploaded it to CompuServe's TRS-80 files area.

The original scheme converted the binary file contents to hexadecimal numbers, encoding those as ASCII digits and letters (09, AF), and adding a newline after every 60 characters. The system quickly gained the addition of a checksum at the end of every line to check for errors, and a subsequent conversion to use the BASIC/S compiler allowed it to run much faster than the original interpreted version.

BinHex files of the era were typically given the file extension .hex. Ports soon appeared for other popular computers of the era, including the Apple II. When CompuServe later added support for 8-bit transfers, the format fell out of use.

When the Macintosh 128K was released in January 1984, the file upload problem still existed on CompuServe. In April, BinHex was ported to the Mac using MS BASIC for Macintosh. The Macintosh File System had introduced the storage of files as a "resource fork" and "data fork", and the Macintosh port only supported encoding of files' data fork, meaning it could only be used for data files. Several newer versions were published during 1984, resulting in BinHex 3 which could encode both forks.

Yves Lempereur, author of the first assembler for the Mac, MacASM, ported BinHex 3 to assembly language, increasing its speed a hundred-fold, and released it as BinHex 1.0.

The simplicity of the original BinHex format made it inefficient, expanding every byte of input into two, as required by the hexadecimal representation, an 8-to-4 bit encoding. Lempereur implemented a new 8-to-6 bit encoding, which decreased file size by 50% and expanded the checksum from 8 to 16-bits, releasing this as BinHex 2.0.

The new encoding used the first 64 ASCII printing characters, including the space, to represent the data, similarly to uuencoding. As the smaller files were incompatible with the older format, Lempereur changed the file extension to .hcx, with c meaning compact. The name BinHex did not change, despite the format no longer being a hexadecimal representation.

See all
User Avatar
No comments yet.