Copyright | (c) 2024 Jared Tobin |
---|---|
License | MIT |
Maintainer | Jared Tobin <jared@ppad.tech> |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
The BIP350 bech32m 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 | bech32m-encoded bytestring |
Encode a base255 human-readable part and input as bech32m.
>>>
let Just bech32m = encode "bc" "my string"
>>>
bech32m
"bc1d4ujqum5wf5kuecwqlxtg"
Checksum
:: ByteString | bech32m-encoded bytestring |
-> Bool |
Verify that a bech32m string has a valid checksum.
>>>
verify "bc1d4ujqum5wf5kuecwqlxtg"
True>>>
verify "bc1d4ujquw5wf5kuecwqlxtg" -- s/m/w
False