bip0173 v0.1.2 Bech32
Encode and decode the Bech32 format, with checksums.
Link to this section Summary
Link to this section Functions
Link to this function
decode(bech)
Decode a Bech32 string.
Examples
iex> Bech32.decode("bech321qpz4nc4pe")
{:ok, {"bech32", [0, 1, 2]}}
iex> Bech32.decode("bc1qw508d6qejxtdg4y5r3zarvary0c5xw7kv8f3t4")
{:ok, {"bc", [0, 14, 20, 15, 7, 13, 26, 0, 25, 18, 6, 11, 13, 8, 21,
4, 20, 3, 17, 2, 29, 3, 12, 29, 3, 4, 15, 24, 20, 6, 14, 30, 22]}}
Link to this function
encode(hrp, data)
Encode a Bech32 string.
Examples
iex> Bech32.encode("bech32", [0, 1, 2])
"bech321qpz4nc4pe"
iex> Bech32.encode("bc", [0, 14, 20, 15, 7, 13, 26, 0, 25, 18, 6, 11, 13,
...> 8, 21, 4, 20, 3, 17, 2, 29, 3, 12, 29, 3, 4, 15, 24,20, 6, 14, 30, 22])
"bc1qw508d6qejxtdg4y5r3zarvary0c5xw7kv8f3t4"