Category:LSL Base64
This is a historical wiki category. Explore the current topic guides →
LSL Header:
{{LSL Header|ml=*}}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== |
Deprecated Functions
There are several Base64 XOR functions in LSL. llXorBase64 is the latest. Deprecated implementations include llXorBase64Strings and llXorBase64StringsCorrect. The big difference between the various versions is how they handle NULL characters.
Original wiki source
Some wiki templates and tables need their original context. View this article on the Second Life Wiki. Technical wording and examples are retained from the source; historical guidance may differ from current behavior.