Copyright | (c) 2024 Jared Tobin |
---|---|
License | MIT |
Maintainer | Jared Tobin <jared@ppad.tech> |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
Unpadded base32 encoding & decoding using the bech32 character set.
Synopsis
- encode :: ByteString -> ByteString
- decode :: ByteString -> Maybe ByteString
base32 encoding and decoding
:: ByteString | base256-encoded bytestring |
-> ByteString | base32-encoded bytestring |
Encode a base256-encoded ByteString
as a base32-encoded
ByteString
, using the bech32 character set.
>>>
encode "jtobin was here!"
"df6x7cnfdcs8wctnyp5x2un9yy"
:: ByteString | base32-encoded bytestring |
-> Maybe ByteString | base256-encoded bytestring |
Decode a ByteString
, encoded as base32 using the bech32 character
set, to a base256-encoded ByteString
.
>>>
decode "df6x7cnfdcs8wctnyp5x2un9yy"
Just "jtobin was here!">>>
decode "dfOx7cnfdcs8wctnyp5x2un9yy" -- s/6/O (non-bech32 character)
Nothing