View Source Base85.Decode (Base85 v0.3.0)
Implements decoding functionality for Base85 encoding.
Summary
Functions
Decodes binary data from a Base85-encoded string.
Decodes binary data from a Base85-encoded string.
Types
@type charset() :: Base85.Charsets.charset()
available character sets
@type decoding_error() ::
:unrecognized_character_set
| :unrecognized_padding
| :invalid_encoded_length
| :invalid_character_for_character_set
| :invalid_padding_data
| :internal_error
decoding errors
options for decoding
@type padding() :: Base85.Padding.padding()
available padding techniques
Functions
@spec decode(binary(), decoding_opts()) :: {:ok, binary()} | {:error, decoding_error()}
Decodes binary data from a Base85-encoded string.
This version returns an :ok
-tuple or :error
-tuple.
Examples
iex> Base85.Decode.decode("N.Xx21Kf++HD3`AI>AZp$Aer7", charset: :safe85, padding: :pkcs7)
{:ok, "some binary data"}
iex> Base85.Decode.decode("f!$Kwf!$Kwf!$Kw", charset: :zeromq, padding: :none)
{:ok, "123412341234"}
iex> Base85.Decode.decode("123", charset: :safe85, padding: :none)
{:error, :invalid_encoded_length}
Options
binary
- the binary data to decode, must be a multiple of 5-characters long;:charset
- an atom indicating the character set to use for decoding;:padding
- an atom indicating which padding technique to use;
Padding methods and encodings may use additional options.
@spec decode!(binary(), decoding_opts()) :: binary()
Decodes binary data from a Base85-encoded string.
This version returns the value or raises an error.
Examples
iex> Base85.Decode.decode!("N.Xx21Kf++HD3`AI>AZp$Aer7", charset: :safe85, padding: :pkcs7)
"some binary data"
iex> Base85.Decode.decode!("f!$Kwf!$Kwf!$Kw", charset: :zeromq, padding: :none)
"123412341234"
iex> Base85.Decode.decode!("123", charset: :safe85, padding: :none)
** (Base85.InvalidEncodedLength) encoded data had invalid encoded length, expected multiple of 5 characters
Options
binary
- the binary data to decode, must be a multiple of 5-characters long;:charset
- an atom indicating the character set to use for decoding;:padding
- an atom indicating which padding technique to use;
Padding methods and encodings may use additional options.