Copyright | (c) 2024 Jared Tobin |
---|---|
License | MIT |
Maintainer | Jared Tobin <jared@ppad.tech> |
Safe Haskell | None |
Language | Haskell2010 |
Data.ByteString.Base58Check
Description
base58check encoding and decoding of strict bytestrings.
base58check is a versioned, checksummed base58 encoding. A checksum is computed by SHA256d-ing a payload, appending its first 4 bytes, and base58-encoding the result.
Synopsis
- encode :: ByteString -> ByteString
- decode :: ByteString -> Maybe ByteString
Documentation
encode :: ByteString -> ByteString Source #
Encode a base256 ByteString
as base58check.
>>>
encode (BS.singleton 0x00 <> "hello world")
"13vQB7B6MrGQZaxCqW9KER"
decode :: ByteString -> Maybe ByteString Source #
Validate and decode a base58check-encoded string. Invalid
base58check inputs will produce Nothing
.
>>>
decode "13vQB7B6MrGQZaxCqW9KER"
Just "\NULhello world">>>
decode "13uQB7B6MrGQZaxCqW9KER" -- s/v/u
Nothing