ppad-base58-0.2.0: base58 and base58check encoding/decoding.
Copyright(c) 2024 Jared Tobin
LicenseMIT
MaintainerJared Tobin <jared@ppad.tech>
Safe HaskellNone
LanguageHaskell2010

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

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