nuid_base64 (nuid v1.0.0)

View Source

Sortable, URL-safe base64 codec.

A variant of the OTP base64 module (RFC 4648) whose alphabet is reordered so that the encoding preserves the byte ordering of the input: if A < B then encode(A) < encode(B). The alphabet, in order, is:

-, 0-9, A-Z, _, a-z

This is the encoding used by nuid:nuid1/0 and nuid:nuid2/0. There is no padding.

Summary

Types

base64_binary()

-type base64_binary() :: binary().

byte_string()

-type byte_string() :: [byte()].

Functions

decode(Base64)

-spec decode(Base64) -> Data when Base64 :: base64_binary(), Data :: binary().

encode(Data)

-spec encode(Data) -> Base64 when Data :: byte_string() | binary(), Base64 :: base64_binary().