base64

Generated by tinox doc

Base64 encode/decode, both standard and URL-safe alphabets. String-in/String-out helpers (encode/decode) for text, and byte-list helpers (encodeBytes/decodeBytes) for binary data -- used throughout the stdlib (amqp10, jwt, oauth2, smtp, tinox-central itself) wherever binary content needs to survive a tinox String, which is NUL-terminated at the runtime level.

Encode decode text

import tinox.core.base64;

class Main
{
    fnc main() -> Int32
    {
        let encoded: String = Base64::encode("hello, tinox!");
        println(encoded);

        let decoded: String = Base64::decode(encoded);
        println(decoded);
        return 0;
    }
}

Encode decode bytes

import tinox.core.base64;

class Main
{
    fnc main() -> Int32
    {
        let data: List<Int64> = [0, 1, 2, 255, 128];
        let encoded: String = Base64::encodeBytes(data);
        println(encoded);

        let decoded: List<Int64> = Base64::decodeBytes(encoded);
        println("roundtrip length: " + decoded.len().toString());
        return 0;
    }
}

fn tinoxBytesToString(bytes: List<Int64>) → String

class Base64

Methods

fn encode(data: String) → String
fn decode(encoded: String) → String
fn charToValue(c: String) → Int64
fn encodeBytes(data: List<Int64>) → String
fn encodeUrlBytes(data: List<Int64>) → String
fn decodeBytes(encoded: String) → List<Int64>
fn urlCharToValue(c: String) → Int64
fn decodeUrlBytes(encoded: String) → List<Int64>