View Source Base64 (base64 v0.1.0)
Provides functions to encode and decode base64.
All functions can specify an optional second argument to determine the character set to be used while encoding and to be expected while decoding. The possible alphabets are:
:standard
: the default as specced in RFC3548.:url_safe
: URL-safe character set with padding (uses-
and_
).:crypt
: as per crypt(3) requirements, (uses.
and/
as the first two values).:bcrypt
: the bcrypt alphabet.:bin_hex
: the alphabet used in BinHex 4.0 files.:imap_map7
: as per IMAP modified UTF-7 requirements (uses+
and,
).
Link to this section Summary
Link to this section Functions
Decodes a valid base64 string.
example
Example
iex> Base64.decode("aGVsbG8gd29ybGQ=")
"hello world"
iex> Base64.decode("aGVsbG8gd29ybGQ", :standard, false)
"hello world"
Encodes a string to base64.
example
Example
iex> Base64.encode("hello world")
"aGVsbG8gd29ybGQ="
iex> Base64.encode("hello world", :standard, false)
"aGVsbG8gd29ybGQ"