HORIZON HASKELLDocslts/ghc-9.10.x248f8f02026-10-05Search names, modules, packages, or :: a typeCtrl K

GHC 9.10.3 · lts/ghc-9.10.x · 248f8f0 · 2026-10-05

Modulecrypto-api-0.13.3Haskell98

Crypto.Classes

This is the heart of the crypto-api package. By making (or having) an instance of Hash, AsymCipher, BlockCipher or StreamCipher you provide (or obtain) access to any infrastructure built on these primitives include block cipher modes of operation, hashing, hmac, signing, etc. These classes allow users to build routines that are agnostic to the algorithm used so changing algorithms is as simple as changing a type signature.

  • 5 classes
  • 19 values
  • Packagecrypto-api-0.13.3
  • Exports24
  • LanguageHaskell98
  • LicenceBSD-3-Clause
  • SourceClasses.hs

Hash class and helper functions

3 declarations
classclass (Serialize d, Eq d, Ord d) => Hash ctx d | d -> ctx, ctx -> d where
#

The Hash class is intended as the generic interface targeted by maintainers of Haskell digest implementations. Using this generic interface, higher level functions such as hash and hash' provide a useful API for comsumers of hash implementations.

Any instantiated implementation must handle unaligned data.

Minimum complete definition: outputLength, blockLength, initialCtx, updateCtx, and finalize.

Methods

valuehashFunc' :: Hash c d => d -> ByteString -> d
#

Obtain a strict hash function whose result is the same type as the given digest, which is discarded. If the type is already inferred then consider using the hash' function instead.

valuehashFunc :: Hash c d => d -> ByteString -> d
#

Obtain a lazy hash function whose result is the same type as the given digest, which is discarded. If the type is already inferred then consider using the hash function instead.

Cipher classes and helper functions

14 declarations
classclass Serialize k => BlockCipher k where
#

The BlockCipher class is intended as the generic interface targeted by maintainers of Haskell cipher implementations.

Minimum complete definition: blockSize, encryptBlock, decryptBlock, buildKey, and keyLength.

Instances must handle unaligned data

Methods

Misc helper functions

7 declarations
valueincIV :: BlockCipher k => IV k -> IV k
#

Increase an IV by one. This is way faster than decoding, increasing, encoding

Orphan instances

1 instance