Base.decode32

You're seeing just the function decode32, go back to Base module for more information.
Link to this function

decode32(string, opts \\ [])

View Source

Specs

decode32(binary(), keyword()) :: {:ok, binary()} | :error

Decodes a base 32 encoded string into a binary string.

Options

The accepted options are:

  • :case - specifies the character case to accept when decoding
  • :padding - specifies whether to require padding

The values for :case can be:

  • :upper - only allows upper case characters (default)
  • :lower - only allows lower case characters
  • :mixed - allows mixed case characters

The values for :padding can be:

  • true - requires the input string to be padded to the nearest multiple of 8 (default)
  • false - ignores padding from the input string

Examples

iex> Base.decode32("MZXW6YTBOI======")
{:ok, "foobar"}

iex> Base.decode32("mzxw6ytboi======", case: :lower)
{:ok, "foobar"}

iex> Base.decode32("mzXW6ytBOi======", case: :mixed)
{:ok, "foobar"}

iex> Base.decode32("MZXW6YTBOI", padding: false)
{:ok, "foobar"}