cardano-crypto-class-2.0.0.0.0.0.0.2: Type classes abstracting over cryptography primitives for Cardano
Safe HaskellSafe-Inferred
LanguageHaskell2010

Cardano.Crypto.Util

Synopsis

Documentation

class Empty a Source #

Instances

Instances details
Empty a Source # 
Instance details

Defined in Cardano.Crypto.Util

class SignableRepresentation a where Source #

A class of types that have a representation in bytes that can be used for signing and verifying.

Instances

Instances details
SignableRepresentation ByteString Source # 
Instance details

Defined in Cardano.Crypto.Util

Simple serialisation used in mock instances

Low level conversions

bytesToNatural :: ByteString -> Natural Source #

Create a Natural out of a ByteString, in big endian.

This is fast enough to use in production.

naturalToBytes :: Int -> Natural -> ByteString Source #

The inverse of bytesToNatural. Note that this is a naive implementation and only suitable for tests.

ByteString manipulation

Base16 conversion

decodeHexByteString :: ByteString -> Int -> Either String ByteString Source #

Decode base16 ByteString, while ensuring expected length.

decodeHexString :: String -> Int -> Either String ByteString Source #

Decode base16 String, while ensuring expected length. Unlike decodeHexByteString this function expects a '0x' prefix.

decodeHexStringQ :: String -> Int -> Q Exp Source #

Decode a String with Hex characters, while ensuring expected length.