ppad-bech32-0.2.1: bech32 and bech32m encoding/decoding, per BIPs 173 & 350.
Copyright(c) 2024 Jared Tobin
LicenseMIT
MaintainerJared Tobin <jared@ppad.tech>
Safe HaskellSafe-Inferred
LanguageHaskell2010

Data.ByteString.Base32

Description

Unpadded base32 encoding & decoding using the bech32 character set.

Synopsis

base32 encoding and decoding

encode Source #

Arguments

:: 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"

decode Source #

Arguments

:: 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