Maintainer | simons@cryp.to |
---|---|
Stability | provisional |
Portability | portable |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
Low-level bindings to OpenSSL's EVP interface. Most users do not need this code. Check out OpenSSL.Digest for a more comfortable interface.
Synopsis
- initDigest :: Algorithm -> Context -> IO ()
- updateDigest :: Context -> Ptr a -> CSize -> IO ()
- finalizeDigest :: Context -> Ptr Word8 -> IO ()
- data OpaqueEngine
- _initDigest :: Context -> Algorithm -> Ptr OpaqueEngine -> IO CInt
- _updateDigest :: Context -> Ptr a -> CSize -> IO CInt
- _finalizeDigest :: Context -> Ptr Word8 -> Ptr CUInt -> IO CInt
Documentation
initDigest :: Algorithm -> Context -> IO () Source #
Configure the given digest context to use the given message digest algorithm. Throws an exception to signal failure, i.e. because the system is out of memory.
updateDigest :: Context -> Ptr a -> CSize -> IO () Source #
Hash the given block of memory and update the digest state accordingly.
This function can be called many times. Then use finalizeDigest
to
retrieve the actual hash value.
finalizeDigest :: Context -> Ptr Word8 -> IO () Source #
Finalize the digest calculation and return the result in the Word8
array
passed as an argument. Naturally, that array is expected to be large enough
to contain the digest. digestSize
or maxDigestSize
are your friends.
This function does not clean up the digest context; this has to be done
with an explicit call to freeContext
(or resetContext
, if you want to
re-use it). However, it does invalidate the digest state so that no further
calls of digestUpdate
can be made without re-initializing the context
first.
data OpaqueEngine Source #
We don't support choosing a custom engine to implement the given
algorithm. This type is just a place holder, and we always pass nullPtr
wherever it is required to let OpenSSL choose whatever engine it thinks is
best.
_initDigest :: Context -> Algorithm -> Ptr OpaqueEngine -> IO CInt Source #