These three values are joined together into a 24-bit string, producing 010011010110000101101110. Encoded in ASCII, the characters M, a, and n are stored as the byte values 77, 97, and 110, which are the 8-bit binary values 01001101, 01100001, and 01101110. In the above quote, the encoded value of Man is TWFu. Here is a well-known idiom from distributed computing: The more typical use is to encode binary data (such as an image) the resulting Base64 data will only contain 64 different ASCII characters, all of which can reliably be transferred across systems that may corrupt the raw source bytes. The example below uses ASCII text for simplicity, but this is not a typical use case, as it can already be safely transferred across all systems that can handle Base64. This is the Base64 alphabet defined in RFC 4648 §4. For instance, uuencode uses uppercase letters, digits, and many punctuation characters, but no lowercase. 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 and BinHex for the TRS-80 (later adapted for the Macintosh) – and could therefore make more assumptions about what characters were safe to use. Other variations share this property but differ in the symbols chosen for the last two values an example is UTF-7. For example, MIME's Base64 implementation uses A– Z, a– z, and 0– 9 for the first 62 values. This combination leaves the data unlikely to be modified in transit through information systems, such as email, that were traditionally not 8-bit clean. The general strategy is to choose 64 characters that are common to most encodings and that are also printable. The particular set of 64 characters chosen to represent the 64-digit values for the base varies between implementations. Encoding an attachment as Base64 before sending, and then decoding when received, assures older SMTP servers will not interfere with the attachment.īase64 encoding causes an overhead of 33–37% relative to the size of the original binary data (33% by the encoding itself up to 4% more by the inserted line breaks). īase64 is also widely used for sending e-mail attachments, because SMTP – in its original form – was designed to transport 7-bit ASCII characters only. Base64 is particularly prevalent on the World Wide Web where one of its uses is the ability to embed image files or other binary assets inside textual assets such as HTML and CSS files. More specifically, the source binary data is taken 6 bits at a time, then this group of 6 bits is mapped to one of 64 unique characters.Īs with all binary-to-text encoding schemes, Base64 is designed to carry data stored in binary formats across channels that only reliably support text content. In computer programming, Base64 is a group of binary-to-text encoding schemes that transforms binary data into a sequence of printable characters, limited to a set of 64 unique characters. Group of binary-to-text encoding schemes using 64 symbols (plus padding)
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |