cryptonite-conduit-0.2.0: cryptonite conduit

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

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 :: (Monad m, HashAlgorithm hash) => Consumer ByteString m (Digest hash)
- hashFile :: (MonadIO m, HashAlgorithm hash) => FilePath -> m (Digest hash)

# Cryptographic hash functions

sinkHash :: (Monad m, HashAlgorithm hash) => Consumer ByteString 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 $ runResourceT (sourceFile fp $$ sinkHash)