(chibi base64)

RFC 3548 base64 encoding and decoding utilities. This API is compatible with the Gauche library rfc.base64.

(base64-decode-string str)

Return a base64 decoded representation of string, also interpreting the alternate 62 & 63 valued characters as described in RFC3548. Other out-of-band characters are silently stripped, and = signals the end of the encoded string. No errors will be raised.

(base64-decode-bytevector src)

(base64-decode [in out])

Variation of the above to read and write to ports.

(base64-encode-string str)

Return a base64 encoded representation of string according to the official base64 standard as described in RFC3548.

(base64-encode-bytevector bv)

(base64-encode [in out])

Variation of the above to read and write to ports.

(base64-encode-header encoding str [start-col])

Return a base64 encoded representation of the string str as above, wrapped in =?ENC?B?...?= as per RFC1522, split across multiple MIME-header lines as needed to keep each lines length less than max-col. The string is encoded as is, and the encoding enc is just used for the prefix, i.e. you are responsible for ensuring str is already encoded according to enc. The optional argument nl is the newline separator, defaulting to crlf.