View Source Tezex.Crypto.Base58Check (tezex v1.0.0)

Base58Check encoding/decoding utils

Link to this section Summary

Functions

Decodes the given string.

Prepends prefix to payload, computes its checksum (double sha256) and encodes in Base58.

Link to this section Functions

@spec decode58!(binary()) :: binary()

Decodes the given string.

examples

Examples

iex> Tezex.Crypto.Base58Check.decode58!("1")
<<0>>
iex> Tezex.Crypto.Base58Check.decode58!("z")
<<57>>
iex> Tezex.Crypto.Base58Check.decode58!("Jf")
:binary.encode_unsigned(1024)
iex> Tezex.Crypto.Base58Check.decode58!("BukQL")
:binary.encode_unsigned(123_456_789)
@spec encode(binary(), binary()) :: nonempty_binary()

Prepends prefix to payload, computes its checksum (double sha256) and encodes in Base58.

examples

Examples

iex> Tezex.Crypto.Base58Check.encode(<<165, 37, 29, 103, 204, 101, 232, 200, 87, 148, 178, 91, 43, 72, 191, 252, 190, 134, 75, 170>>, <<6, 161, 164>>)
"tz3bPFa6mGv8m4Ppn7w5KSDyAbEPwbJNpC9p"