morley-0.7.0: Developer tools for the Michelson Language

Safe HaskellNone
LanguageHaskell2010

Tezos.Crypto.Util

Description

Utilities shared by multiple cryptographic primitives.

Synopsis

Documentation

encodeBase58Check :: ByteString -> Text Source #

Encode a bytestring in Base58Check format.

decodeBase58Check :: Text -> Maybe ByteString Source #

Decode a bytestring from Base58Check format.

decodeBase58CheckWithPrefix :: ByteString -> Text -> Either B58CheckWithPrefixError ByteString Source #

Parse a base58check encoded value expecting some prefix. If the actual prefix matches the expected one, it's stripped of and the resulting payload is returned.

formatImpl :: ByteArrayAccess x => ByteString -> x -> Text Source #

Template for 'format*' functions.

parseImpl :: ByteString -> (ByteString -> Either CryptoParseError res) -> Text -> Either CryptoParseError res Source #

Template for 'parse*' functions.

firstRight :: NonEmpty (Either e a) -> Either e a Source #

Returns first encountered Right in a list. If there are none, returns arbitrary Left. It is useful to implement parsing.

deterministic :: ByteString -> MonadPseudoRandom ChaChaDRG a -> a Source #

Do randomized action using specified seed.