cardano-crypto-class-2.5.1.0: 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

bytesToInteger ∷ ByteString → Integer Source #

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

bytesToNatural ∷ ByteString → Natural Source #

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

naturalToBytes ∷ Int → Natural → ByteString Source #

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

byteArrayToInteger ∷ ByteArray → Integer Source #

Create a Integer out of a ByteArray, in big endian.

byteArrayToNatural ∷ ByteArray → Natural Source #

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

naturalToByteArray ∷ Int → Natural → ByteArray Source #

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

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.