std/base64
import std/base64 to use it. Source: src/std/base64.iyi at v0.18.0.
encode is the alphabet with + / and = padding, no line breaks (RFC 4648 §4). urlsafe_encode uses - _ and the same padding. decode accepts both alphabets, ignores ASCII whitespace, and panics on a byte that is neither. Missing padding is allowed ("QQ" is "A"), but nothing is dropped without a word: data after the padding, data inside it ("QU=JD"), more = than the group needs, and a final group of one character ("Q", which cannot encode a byte) are each refused.
Base64struct
pub struct Base64
def self.decode(text : String) : String
protected def self.decode_values : Array(Int32)
def self.encode(data : String) : String
def initialize
protected def self.pairs_of(alphabet : String) : Array(Int32)
def self.urlsafe_encode(data : String) : String
end
Base64, RFC 4648, written in iyi.