std::encoding::base64Base64 encoding and decoding — pure Hew implementation.
Encode binary data to Base64 strings and decode Base64 strings back to binary data. Supports both standard and URL-safe alphabets.
import std::encoding::base64;
fn main() {
let data: bytes = bytes::new();
data.push(72); // H
data.push(105); // i
let s = base64.encode(data);
println(s); // "SGk="
let back = base64.decode(s);
println(back.len()); // 2
}
encodeEncode binary data to a standard Base64 string.
encode_urlEncode binary data to a URL-safe Base64 string.
decodeDecode a Base64 string to binary data.
Returns an empty bytes buffer if the input is not valid Base64.
b64_charMap a 6-bit index (0–63) to its Base64 ASCII code.
encode_implEncode binary data to a Base64 string using the standard or URL-safe alphabet.
decode_charMap a single-character string to its 6-bit Base64 value. Returns -1 for invalid characters.