Category:LSL Base64
LSL Portal | Functions | Events | Types | Operators | Constants | Flow Control | Script Library | Categorized Library | Tutorials |
About Base64 encoding
Base64 conversion expands three bytes of arbitrary binary data into four bytes of common ASCII characters in a completely reversible algorithm. It is generally used to convert binary data to strings so they can be sent across a text interface where ASCII control characters might be misinterpreted as end of string (\0) newline (\n) or otherwise not be transferred properly to the receiving process. In LSL this might be used to store binary data in an object's description, break data into bytes for cryptographic processing, or send data from one process to another using chat or linked messages.
Base64 input can be any sequence of bytes, the output consists exclusively of uppercase and lowercase letters, digits and the plus (+), slash (/) and equals (=) characters. Conversion to Base64 is done in blocks of three bytes (24 bits), padded if needed. These twenty-four bits are split into four six bit numbers which become an index to the conversion key ("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/") and written out as the eight bit ASCII character. Since the data is converted three bytes at a time, zero one or two equals characters are added to indicate how much padding was done in the last block. See the Wikipedia article for more information.
Examples
String and integer data in Base64.
Text | Base64 |
Abcde | QWJjZGU= |
ⓐⓑⓒⓓⓔ | 4pOQ4pOR4pOS4pOT4pOU |
12345 (as an integer) | AAAwOQ== |
Pages in category "LSL Base64"
The following 5 pages are in this category, out of 5 total.