Copyright | (c) 2024 Jared Tobin |
---|---|
License | MIT |
Maintainer | Jared Tobin <jared@ppad.tech> |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
The BIP0173 bech32 checksummed base32 encoding, with checksum verification.
Synopsis
- encode :: ByteString -> ByteString -> Maybe ByteString
- verify :: ByteString -> Bool
Encoding
:: ByteString | base255-encoded human-readable part |
-> ByteString | base255-encoded data part |
-> Maybe ByteString | bech32-encoded bytestring |
Encode a base255 human-readable part and input as bech32.
>>>
let Just bech32 = encode "bc" "my string"
>>>
bech32
"bc1d4ujqum5wf5kuecmu02w2"
Checksum
:: ByteString | bech32-encoded bytestring |
-> Bool |
Verify that a bech32 string has a valid checksum.
>>>
verify "bc1d4ujqum5wf5kuecmu02w2"
True>>>
verify "bc1d4ujquw5wf5kuecmu02w2" -- s/m/w
False