Learn something new every day
More Info... by email
BinHex is a method used in computing to convert a binary file into a text format so that it may be transmitted over a network. This is an older file-encoding technique, devised as a means to help deal with early computer network communication protocols that were incapable of transmitting binary data. The files converted in this manner will have one of three possible filename suffixes: .hex, .hcx, or .hqx, depending on the version. The encoded file's text is readable in a plain text viewer, however, and the BinHex version decoding requirement appears on the first line of the file.
The first BinHex encoding technique was developed back in 1981 to deal with the then common practice where data transferred over communication channels was American Standard Code for Information Interchange (ASCII) text characters. This first implementation was devised by Tim Mann and used on the TRS-80® personal computers of the early 1980s. As the Apple® Macintosh computer emerged, the technique was ported to work with Macintosh® files and was further developed by a man named Yves Lempereur, who improved on the encoding speed and compression.
At its core, the original BinHex encoding method takes groups of four binary digits, or bits, in a binary file and represents them as a single hexadecimal digit, which are the numbers 0 through 9 and the letters A through F. Each hexadecimal digit can then be paired up with another and encoded as an ASCII text character. This is sometimes referred to as an 8-to-4 encoding, since the process uses eight bits to represent four. Of course, this makes the encoded .hex file much larger than its original binary counterpart, but the plain text can also be split up into separate files for transmission.
The BinHex encoding method also created an archival, or encapsulation, technique for dealing with the two-part nature of the early Apple® Macintosh® file format. These files had two primary components: a resource fork and a data fork. With a BinHex encoding, both of the Macintosh® file forks would be encapsulated into the encoding, allowing for the receiving end to decode the entire file. As a result, the encoding method became the primary archival and transmission format on the Macintosh® computers of the 1980s and 90s.
After establishing its foothold on the Macintosh®, the BinHex technique needed improvement. A second version was developed that no longer used hexadecimal encoding, instead implementing an 8-to-6 encoding technique, which reduced the encoded file size by half. These new compact files, though no longer technically hexadecimal in nature, still held onto the BinHex naming format, though changed the file extension to .hcx. This method had issues with computer systems that used non-English language characters, though, whereby the file would be damaged during the decoding process as some characters were being translated.
The final BinHex version fixed these issues by using only characters that wouldn't automatically be translated during decoding. The encoding method also included additional error checking techniques that ensured against any unintended changes to the text. These more stable encoded files were then given the .hqx suffix, but still retained the compression of their .hcx predecessors.