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.