
The 95 isprint codes 32 to 126 are known as the ASCII printable characters. The efficiency listed is the ratio between number of bits in the input and the number of bits in the encoded output. The table below compares the most used forms of binary-to-text encodings. For example, the ViewState component of ASP.NET uses base64 encoding to safely transmit text via HTTP POST, in order to avoid delimiter collision. This is sometimes referred to as 'ASCII armoring'. For example:īy using a binary-to-text encoding on messages that are already plain text, then decoding on the other end, one can make such systems appear to be completely transparent. Many programs perform this conversion to allow for data-transport, such as PGP and GNU Privacy Guard (GPG).īinary-to-text encoding methods are also used as a mechanism for encoding plain text. This process is referred to as binary to text encoding. Upon safe arrival at its destination, it is then decoded back to its eight-bit form. To accomplish this, the data is encoded in some way, such that eight-bit data is encoded into seven-bit ASCII characters (generally using only alphanumeric and punctuation characters-the ASCII printable characters). It is often desirable, however, to be able to send non-textual data through text-based systems, such as when one might attach an image file to an e-mail message. For example, if the value of the eighth bit is not preserved, the program might interpret a byte value above 127 as a flag telling it to perform some function. Many computer programs came to rely on this distinction between seven-bit text and eight-bit binary data, and would not function properly if non-ASCII characters appeared in data that was expected to include only ASCII text.
BASE64 BINARY TO ASCII TEXT ENCODING CODE
Files that contain machine-executable code and non-textual data typically contain all 256 possible eight-bit byte values. In contrast, most computers store data in memory organized in eight-bit bytes. PGP documentation ( RFC ) uses the term " ASCII armor" for binary-to-text encoding when referring to Base64. These encodings are necessary for transmission of data when the channel does not allow binary data (such as email or NNTP) or is not 8-bit clean. More precisely, it is an encoding of binary data in a sequence of printable characters. The earliest instances of this type of encoding were created for dial-up communication between systems running the same OS - for example, UUENCODE for UNIX,īinHex for the TRS-80 (later adapted for the Macintosh) - and could therefore make more assumptions about what characters were safe to use.įor example, uuencode uses uppercase letters, numbers, and many punctuation marks, but not lowercase.A binary-to-text encoding is encoding of data in plain text. Other variants share this property, but differ in the characters selected for the last two values an example is UTF-7. For example, the Base64 MIME implementation uses A - Z, A-z, and 0-9įor the first 62 values. When transmitting through information systems such as e-mail, which have not traditionally been 8-bit clean. This combination leaves the data unlikely to be modified The overall strategy is to chooseĦ4 characters, which are members of a subset common to most encodings, as well as printable. total 24 bits) can be represented by four 6-bit base64 digits.Ī certain set of 64 characters chosen to represent the 64 place-values for the base varies between implementations. The term Base64 originates from a specific MIME content transfer encoding.Įach base64 digit represents exactly 6 bits of data. Base64 is a group of similar binary-to-text encoding schemes that represent binary data in ASCII string format by translating it into a radix-64 representation.
