Still others add headers or trailers to the text.
Other systems have limits on the number of characters that may appear between line breaks, such as the "1000 characters per line" limit of some SMTP software, as allowed by RFC 2821.Some systems have a more limited character set they can handle not only are they not 8-bit clean, some cannot even handle every printable ASCII character.
However, binary-to-text encoding methods are also used as a mechanism for encoding plain text. PGP documentation (RFC 4880) 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. Many programs perform this conversion to allow for data-transport, such as PGP and GNU Privacy Guard (GPG).Ī binary-to-text encoding is encoding of data in 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). The default initial CRC is zero.It is often desirable, 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. The argument should already be RLE-coded.īinascii.crc_hqx(data, value): Compute a 16-bit CRC value of data, starting with value as the initial CRC, and return the result.īinascii.crc32(data): Compute CRC-32, the 32-bit checksum of data, starting with an initial CRC of value. The string should contain a complete number of binary bytes, or have the remaining bits zero.īinascii.rledecode_hqx(data): Perform REL-decompression on the data, as per the binhex4 standard.īinascii.rlecode_hqx(data): Perform binhex4 style RLE-compression on data and return the result.īinascii.b2a_hqx(data): Perform hexbin4 binary-to-ASCII translation and return the resulting string.
The return value is the converted line(s).īinascii.a2b_hqx(string): Convert binhex4 formatted ASCII data to binary, without doing RLEdecompression. The return value is the converted line, including a newline char if a newline is true.īinascii.a2b_qp(data): Convert a block of quoted-printable data back to binary and return the binary data.īinascii.b2a_qp(data): Convert binary data to a line(s) of ASCII characters in quoted-printable encoding. Line data may be followed by white space.īinascii.b2a_uu(data): Convert binary data to a line of ASCII characters, the return value is the converted line, including a newline char.īinascii.a2b_base64(string): Convert a block of base64 data back to binary and return the binary data.īinascii.b2a_base64(data): Convert binary data to a line of ASCII characters in base64 coding. Lines normally contain 45 (binary) bytes, except for the last line. These function are named as a2b_* or b2a_*īinascii.a2b_uu(string): Convert a single line of uuencoded data back to binary and return the binary data. The binascii module defines the following functions. They are used by the higher-level modules such as uu, base64 or binhex modules. The binascii module contains low-level functions written in C for greater speed. The binascii module enables conversion between binary and various ASCII encoded binary representations.