HOME

TheInfoList



OR:

BinHex, originally short for "binary-to-hexadecimal", is a
binary-to-text encoding A binary-to-text encoding is encoding of data in plain text. More precisely, it is an encoding of binary data in a sequence of printable characters. These encodings are necessary for transmission of data when the channel does not allow binary dat ...
system that was used on the
classic Mac OS Mac OS (originally System Software; retronym: Classic Mac OS) is the series of operating systems developed for the Macintosh family of personal computers by Apple Computer from 1984 to 2001, starting with System 1 and ending with Mac OS 9. The ...
for sending binary files through
e-mail Electronic mail (email or e-mail) is a method of exchanging messages ("mail") between people using electronic devices. Email was thus conceived as the electronic ( digital) version of, or counterpart to, mail, at a time when "mail" meant ...
. Originally a
hexadecimal In mathematics and computing, the hexadecimal (also base-16 or simply hex) numeral system is a positional numeral system that represents numbers using a radix (base) of 16. Unlike the decimal system representing numbers using 10 symbols, hexa ...
encoding, subsequent versions of BinHex are more similar to uuencode, but combined both "forks" of the Mac file system together along with extended file information. BinHexed files take up more space than the original files, but will not be corrupted by non-"
8-bit clean ''8-bit clean'' is an attribute of computer systems, communication channels, and other devices and software, that handle 8-bit character encodings correctly. Such encoding include the ISO 8859 series and the UTF-8 encoding of Unicode. History ...
" software.


History


TRS-80 BinHex (.hex)

BinHex was originally written in 1981 by Tim Mann for the
TRS-80 The TRS-80 Micro Computer System (TRS-80, later renamed the Model I to distinguish it from successors) is a desktop microcomputer launched in 1977 and sold by Tandy Corporation through their Radio Shack stores. The name is an abbreviation of '' ...
, as a stand-alone version of an encoding scheme originally built into a popular
terminal emulator A terminal emulator, or terminal application, is a computer program that emulates a video terminal within some other display architecture. Though typically synonymous with a shell or text terminal, the term ''terminal'' covers all remote termin ...
, ST80-III by Lance Micklus. BinHex was used for sending files via major
online service An online service provider (OSP) can, for example, be an Internet service provider, an email provider, a news provider (press), an entertainment provider (music, movies), a search engine, an e-commerce site, an online banking site, a health site, ...
s such as
CompuServe CompuServe (CompuServe Information Service, also known by its initialism CIS) was an American online service provider, the first major commercial one in the world – described in 1994 as "the oldest of the Big Three information services (the oth ...
, which were not "8-bit clean" and required ASCII armoring to survive. Not everyone used ST-80, however, so Mann wrote BinHex to allow users of other emulators to use the format. The original ST-80 system worked by converting the binary file contents to
hexadecimal In mathematics and computing, the hexadecimal (also base-16 or simply hex) numeral system is a positional numeral system that represents numbers using a radix (base) of 16. Unlike the decimal system representing numbers using 10 symbols, hexa ...
numbers, which were themselves encoded as
ASCII ASCII ( ), abbreviated from American Standard Code for Information Interchange, is a character encoding standard for electronic communication. ASCII codes represent text in computers, telecommunications equipment, and other devices. Because of ...
digits and letters. It then added a
newline Newline (frequently called line ending, end of line (EOL), next line (NEL) or line break) is a control character or sequence of control characters in character encoding specifications such as ASCII, EBCDIC, Unicode, etc. This character, or a ...
after every 60 characters. The system became very popular after Mann uploaded it to
Compuserve CompuServe (CompuServe Information Service, also known by its initialism CIS) was an American online service provider, the first major commercial one in the world – described in 1994 as "the oldest of the Big Three information services (the oth ...
's TRS-80 files area. The system quickly gained the addition of a
checksum A checksum is a small-sized block of data derived from another block of digital data for the purpose of detecting errors that may have been introduced during its transmission or storage. By themselves, checksums are often used to verify data ...
at the end of every line to check for errors. Bill Stockwell converted that version to the BASIC/S compiler, which ran much faster than Mann's interpreted version. BinHex files of the era were typically given the
file extension A filename extension, file name extension or file extension is a suffix to the name of a computer file (e.g., .txt, .docx, .md). The extension indicates a characteristic of the file contents or its intended use. A filename extension is typically d ...
. Ports soon appeared for other popular platforms of the era, including the
Apple II The Apple II (stylized as ) is an 8-bit home computer and one of the world's first highly successful mass-produced microcomputer products. It was designed primarily by Steve Wozniak; Jerry Manock developed the design of Apple II's foam-m ...
. CompuServe later added support for 8-bit transfers, and the format quickly disappeared.


Mac BinHex (.hex)

The file upload problem still existed on CompuServe when the Mac was first released in 1984. In April 1984, William Davis ported BinHex to the Mac using
Microsoft BASIC Microsoft BASIC is the foundation software product of the Microsoft company and evolved into a line of BASIC interpreters and compiler(s) adapted for many different microcomputers. It first appeared in 1975 as Altair BASIC, which was the first ve ...
to produce a version that was largely identical to the TRS-80 versions of the same era. This version only supported encoding of the "data fork", ignoring the
resource fork The resource fork is a fork (file system), fork or section of a computer file, file on Apple Inc., Apple's classic Mac OS operating system, which was also carried over to the modern macOS for compatibility, used to store structured data along with t ...
, which meant it could only be used for data files. The rise in use of
Internet The Internet (or internet) is the global system of interconnected computer networks that uses the Internet protocol suite (TCP/IP) to communicate between networks and devices. It is a '' network of networks'' that consists of private, pub ...
e-mail coincided roughly with the release of the Macintosh, and Davis's version was posted on the
Info-Mac Info-Mac is an online community, news aggregator and shareware file hosting service covering Apple Inc. products, including the iPhone, iPod and especially the Macintosh. Established in 1984 as an electronic mailing list, Info-Mac is notable a ...
mailing list A mailing list is a collection of names and addresses used by an individual or an organization to send material to multiple recipients. The term is often extended to include the people subscribed to such a list, so the group of subscribers is re ...
by Joel Heller in June 1984. Several newer versions were published during 1984, resulting in BinHex 3 that could encode both forks. Yves Lempereur, author of the first
assembler Assembler may refer to: Arts and media * Nobukazu Takemura, avant-garde electronic musician, stage name Assembler * Assemblers, a fictional race in the ''Star Wars'' universe * Assemblers, an alternative name of the superhero group Champions of A ...
for the Mac, MacASM, found that in order to upload his files to CompuServe he had to use BinHex. The
BASIC BASIC (Beginners' All-purpose Symbolic Instruction Code) is a family of general-purpose, high-level programming languages designed for ease of use. The original version was created by John G. Kemeny and Thomas E. Kurtz at Dartmouth College ...
version was very slow, so Lempereur ported BinHex 3 to assembler and released it as BinHex 1.0. The program was roughly a hundred times as fast as the BASIC version, and soon upgrade requests were flooding in.


Compact BinHex (.hcx)

The original BinHex was a fairly simple format, one that was not very efficient because it expanded every byte of input into two, as required by the hexadecimal representation—an 8-to-4 bit encoding. For BinHex 2.0, Lempereur used a new 8-to-6 encoding that decreased file size by 50%. He also took the opportunity to expand the checksum from 8 to 16-bits. This new encoding used the first 64 ASCII printing characters, including the space, to represent the data, similarly to uuencode. Even though the new encoding was no longer
hexadecimal In mathematics and computing, the hexadecimal (also base-16 or simply hex) numeral system is a positional numeral system that represents numbers using a radix (base) of 16. Unlike the decimal system representing numbers using 10 symbols, hexa ...
in nature, the established name of the program was retained. The smaller files were incompatible with the older ones, so the extension became .hcx, c for compact. The new version replaced the earlier ones "overnight".


BinHex 4 (.hqx)

Lempereur had concerns about some of the features of BinHex, notably its use of a checksum instead of a
cyclic redundancy check A cyclic redundancy check (CRC) is an error-detecting code commonly used in digital networks and storage devices to detect accidental changes to digital data. Blocks of data entering these systems get a short ''check value'' attached, based on t ...
(CRC) and the fact that the
metadata Metadata is "data that provides information about other data", but not the content of the data, such as the text of a message or the image itself. There are many distinct types of metadata, including: * Descriptive metadata – the descriptive ...
information in the header was in plain text and thus could be corrupted in the same way as the data. In order to solve all of these problems, Lempereur released BinHex 4.0 in 1985, skipping 3.0 to avoid confusion with the now long-dead BASIC version. 4.0 first combined the data fork, resource fork and file metadata into a common 8-bit format, ran
run length encoding Run-length encoding (RLE) is a form of lossless data compression in which ''runs'' of data (sequences in which the same data value occurs in many consecutive data elements) are stored as a single data value and count, rather than as the original ...
(RLE) on the result to provide some compression, and then ran the 8->6 conversion on the result and protected everything with multiple CRCs. The resulting .hqx files were roughly the same size of the .hcx's, but much more robust.


BinHex 5

At about the time BinHex 4 was released, most online services started supporting robust 8-bit file transfer protocols such as
ZMODEM ZMODEM is an inline file transfer protocol developed by Chuck Forsberg in 1986, in a project funded by Telenet in order to improve file transfers on their X.25 network. In addition to dramatically improved performance compared to older protocols, ...
, and the need for ASCII armoring went away. This left a problem on the Mac, however, as there was still the need to encode the two forks into one. A team effort among Macintosh communications programmers, including Lempereur, resulted in
MacBinary MacBinary is a file format that combines the two ''forks'' of a classic Mac OS file into a single file, along with HFS's extended metadata. The resulting file is suitable for transmission over FTP, the World Wide Web, and electronic mail. The do ...
. These .bin files left the contents of the forks in their original 8-bit format and added a simple header for combining them on reception; MacBinary files were thus much smaller than BinHex. Lempereur released BinHex 5.0, almost identical to 4.0 with the exception that it used MacBinary to combine the forks before running the 8-to-6 encoding. This saw little use, as he expected. On the
Internet The Internet (or internet) is the global system of interconnected computer networks that uses the Internet protocol suite (TCP/IP) to communicate between networks and devices. It is a '' network of networks'' that consists of private, pub ...
, e-mail was still the primary method of moving files. At the time relatively few people had full access to the Internet, and services like
FTPmail FTPmail is the term used for the practice of using an FTPmail server to gain access to various files over the Internet. An FTPmail server is a proxy server which (asynchronously) connects to remote file transfer protocol, FTP servers in response to ...
were the only way many users could download files. Years later when he first got onto the Internet, Lempereur was surprised to find that BinHex 4.0 was still extremely popular. The same ends could be achieved by first using
MacBinary MacBinary is a file format that combines the two ''forks'' of a classic Mac OS file into a single file, along with HFS's extended metadata. The resulting file is suitable for transmission over FTP, the World Wide Web, and electronic mail. The do ...
or
AppleSingle AppleSingle Format and AppleDouble Format are file formats developed by Apple Computer to store Mac OS "dual-forked" files on the Unix filesystem being used in A/UX, the Macintosh platform's first Unix-like operating system. AppleSingle combined b ...
to combine the forks, and then using Uuencode or
Base64 In computer programming, Base64 is a group of binary-to-text encoding schemes that represent binary data (more specifically, a sequence of 8-bit bytes) in sequences of 24 bits that can be represented by four 6-bit Base64 digits. Common to all bina ...
on the resulting file, but none of these solutions ever became popular and BinHex 4.0 survived well into the late 1990s. File archives of
classic Mac OS Mac OS (originally System Software; retronym: Classic Mac OS) is the series of operating systems developed for the Macintosh family of personal computers by Apple Computer from 1984 to 2001, starting with System 1 and ending with Mac OS 9. The ...
software are still filled with BinHexed files.


BinHex 4 file format

Looking at the contents of a BinHex file, one will notice that it has a message usually on the first line identifying it as BinHex, followed by many 64-character lines made up of seemingly random letters, numbers, and punctuation marks. Here is a sample of what BinHex actually looks like:

(This file must be converted with BinHex 4.0)

:$f*TEQKPH#jdCA0d,R0TG!"6594%8dP8)3#3"!&m!*!%EMa6593K!!%!!!&mFNa
KG3,r!*!$& 
There_must_be_a_text_line,_which_is_used_by_users_and_tools_to_recognize_BinHex_versions:_(This_file_must_be_converted_with_BinHex_4.0). Any_text_before_this_line_is_to_be_ignored._MIME_Content_Type_for_BinHex_Encoded_Files._Faltstrom,_P._&_Crocker,_D._&_Fair.,_E._(December_1994). The_rest_of_the_file_consists_of_three_parts,_a_header_(containing_file_name,_size_etc.),_a_data_fork_(containing_the_file_data)_and_a_resource_fork_The_resource_fork_is_a_fork_(file_system),_fork_or_section_of_a_computer_file,_file_on_Apple_Inc.,_Apple's_classic_Mac_OS_operating_system,_which_was_also_carried_over_to_the_modern_macOS_for_compatibility,_used_to_store_structured_data_along_with_t_...
._Each_has_a_two-byte_Cyclic_redundancy_check.html" ;"title="r$3d,BQPZD'9i,R4PFh3!RQ+!!"AV#J#3!i!!N!@QKUjrU!#3'[q 3"&4&@&483N)f!3#Xaj6bV-H8mJ!!!B3!N!0"!*!$[3#3!cR@iiY)!*!'[I%4!!J Fp$X%X3@J!mZE6!GRiKUi$HGKMf0U61S46%i1"AB!TI,fLl!d1X3RDDE8ALfTCbM 8UP9p4iUqY-0k4krHpk9XK@`rbj2Ti'U@5rGH@+[fr-i4T6-qXpfl26,k!H5$Nml TIkI'(l3GI4)f8mII&01CNEbC2LrNLBeaZ1HG@$G8!Z6"k)hh,q9p"r6FC*!!Se" (ic,Pd(4(b`pflKC`H1&JN5)GVX3mREdH55[l`%`Yhp%q092c`A(hPV)!83Dr&f4 $$L#I1aM-"VjqV-q$34KQq6$M$f8#,Zc,i),!(`*ZN!$K$rS!LA%3cL+dYi"@,K( Z"`#3!fKi!!!: There must be a text line, which is used by users and tools to recognize BinHex versions: (This file must be converted with BinHex 4.0). Any text before this line is to be ignored. MIME Content Type for BinHex Encoded Files. Faltstrom, P. & Crocker, D. & Fair., E. (December 1994). The rest of the file consists of three parts, a header (containing file name, size etc.), a data fork (containing the file data) and a
resource fork The resource fork is a fork (file system), fork or section of a computer file, file on Apple Inc., Apple's classic Mac OS operating system, which was also carried over to the modern macOS for compatibility, used to store structured data along with t ...
. Each has a two-byte Cyclic redundancy check">CRC checksum. Everything except the (This file... line is then seen as an area of binary data, which is encoded to ASCII characters. The encoding algorithm says that three bytes input are divided into four 6-bit values, in a way similar to the way in which
Base64 In computer programming, Base64 is a group of binary-to-text encoding schemes that represent binary data (more specifically, a sequence of 8-bit bytes) in sequences of 24 bits that can be represented by four 6-bit Base64 digits. Common to all bina ...
does. Number 0–63 are given characters according to the following list !"#$%&'()*+,-012345689@ABCDEFGHIJKLMNPQRSTUVXYZ[`abcdefhijklmpqr When encoding, a should be inserted after every 64 characters. After encoding, a colon is placed before and after the data.


References


Bibliography

* *


See also

* Binary-to-text encoding for a comparison of various encoding algorithms


External links


BinHex 4.0 Definition - Peter N Lewis, Aug 1991.

Convert::BinHex
a Perl module to encode and decode BinHex files
macutils
converts between different Macintosh file encodings for UNIX
UUDeview
cross platform command line decoder
Online BinHex encoder/decoder
{{DEFAULTSORT:Binhex Archive formats Binary-to-text encoding formats Computer-related introductions in 1984