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