Base64

Encoding and decoding of Base64, supporting both standard (RFC 4648 §4) and URL-safe (RFC 4648 §5) alphabets. All functions operate on bytes values.

proc b64Encode(x: bytes, param urlSafe = false) : bytes

Encode binary data to a Base64 string.

When urlSafe is false (the default), uses the standard alphabet (+, /). When true, uses the URL-safe alphabet (-, _).

proc b64Decode(x: bytes, param urlSafe = false) : bytes

Decode a Base64 string to binary data.

When urlSafe is false (the default), expects the standard alphabet. When true, expects the URL-safe alphabet.

proc b64StandardEncode(x: bytes) : bytes

Encode binary data using the standard Base64 alphabet (+, /).

proc b64StandardDecode(x: bytes) : bytes

Decode a Base64 string using the standard alphabet (+, /).

proc b64UrlSafeEncode(x: bytes) : bytes

Encode binary data using the URL-safe Base64 alphabet (-, _).

proc b64UrlSafeDecode(x: bytes) : bytes

Decode a Base64 string using the URL-safe alphabet (-, _).