HORIZON HASKELLDocslts/ghc-9.10.xc74966e2026-09-27Search names, modules, packages, or :: a typeCtrl K

GHC 9.10.3 · lts/ghc-9.10.x · c74966e · 2026-09-27

Modulehopenssl-2.2.5Haskell2010

OpenSSL.EVP.Digest.Algorithm

Low-level bindings to OpenSSL's EVP interface. Most users do not need this code. Check out OpenSSL.Digest for a more comfortable interface.

  • 1 type
  • 8 values
  • Packagehopenssl-2.2.5
  • Exports9
  • LanguageHaskell2010
  • LicenceBSD-3-Clause
  • SourceAlgorithm.hsc
newtypenewtype Algorithm
#

An opaque handle into OpenSSL's collection of message digest algorithms. Use digestByName to look up any of the available algorithms by name. For the sake of convenience, Algorithm is an instance of IsString so that the compiler can transparently map String literals to algorithms via fromString if the XOverloadedStrings extension is enabled.

Example1 expression
fromString "sha256" == digestByName "sha256"True

Constructors

Instances3Eq, Show, IsString
  • Eq AlgorithmDefined in hopenssl-2.2.5 · OpenSSL.EVP.Digest.Algorithm
  • Show AlgorithmDefined in hopenssl-2.2.5 · OpenSSL.EVP.Digest.Algorithm
  • IsString AlgorithmDefined in hopenssl-2.2.5 · OpenSSL.EVP.Digest.Algorithm

Look up a digest algorithm engine by name. Algorithms usually offered by OpenSSL are "md2", "md5", "sha1", "mdc2", "ripemd160", "blake2b512", "blake2s256", "sha224", "sha256", "sha384", and "sha512", but the exact set may vary between platforms. Throws UnknownAlgorithm if the requested algorithm is not known.

Variant of digestByName that signals failure by evaluating to Nothing rather than failing.

Example2 expressions
digestByName' "sha256" == Just (digestByName "sha256")TruedigestByName' "Guess what?" :: Maybe AlgorithmNothing
valuedigestSize :: Algorithm -> Int
#

Return the size of the digest in bytes that the given algorithm will produce.

Example1 expression
digestSize (digestByName "sha256")32
valuemaxDigestSize :: Int
#

The largest possible digest size of any of the algorithms supported by this library will generate. So if you want to store a digest without bothering to retrieve the appropriate size with digestSize first, allocate a buffer of that size.

Return the block size the the given algorithm operates with.

Example1 expression
digestBlockSize (digestByName "sha256")64