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.
[1] The original scheme converted the binary file contents to hexadecimal numbers, encoding those as ASCII digits and letters (0–9, A–F), 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.
[2] 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.
This version performed the following sequence of operations:[3] The resulting files were roughly the same size as those from BinHex 2, but much more robust, with the metadata information in the header being protected from corruption by no longer being in plain text.
This obviated the need for ASCII armoring, but on the Macintosh there was still the need to encode the two forks into one, leading to the development of the MacBinary file format.