Crypto.Hash.Conduit

crypton-conduit-0.2.3: crypton conduit

License | BSD-style
Maintainer | Vincent Hanquez <vincent@snarc.org>
Stability | experimental
Portability | unknown
Safe Haskell | None
Language | Haskell2010

Crypto.Hash.Conduit

Contents

- Cryptographic hash functions

Description

A module containing Conduit facilities for hash based functions.

this module is vaguely similar to the crypto-conduit part related to hash on purpose, as to provide an upgrade path. The api documentation is pulled directly from this package and adapted, and thus are originally copyright Felipe Lessa.

Synopsis

- sinkHash :: forall (m :: Type -> Type) hash o. (Monad m, HashAlgorithm hash) => ConduitT ByteString o m (Digest hash)
- hashFile :: (MonadIO m, HashAlgorithm hash) => FilePath -> m (Digest hash)

# Cryptographic hash functions

sinkHash :: forall (m :: Type -> Type) hash o. (Monad m, HashAlgorithm hash) => ConduitT ByteString o m (Digest hash) #

A `Sink` that hashes a stream of `ByteString` `s` and creates a digest `d`.

hashFile :: (MonadIO m, HashAlgorithm hash) => FilePath -> m (Digest hash) #

Hashes the whole contents of the given file in constant memory. This function is just a convenient wrapper around `sinkHash` defined as:

    hashFile fp = liftIO $ runConduitRes (sourceFile fp .| sinkHash)