packages feed

cryptohash-conduit (empty) → 0.1.0

raw patch · 5 files changed

+111/−0 lines, 5 filesdep +basedep +bytestringdep +conduitsetup-changed

Dependencies added: base, bytestring, conduit, cryptohash, transformers

Files

+ Crypto/Hash/Conduit.hs view
@@ -0,0 +1,48 @@+{-# LANGUAGE RankNTypes, BangPatterns #-}+-- |+-- Module      : Crypto.Hash.Conduit+-- License     : BSD-style+-- Maintainer  : Vincent Hanquez <vincent@snarc.org>+-- Stability   : experimental+-- Portability : unknown+--+-- 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.+--+module Crypto.Hash.Conduit+    ( -- * Cryptographic hash functions+      sinkHash+    , hashFile+    ) where++import Crypto.Hash+import qualified Data.ByteString as B++import Data.Conduit+import Data.Conduit.Binary (sourceFile)++import Control.Monad.IO.Class (MonadIO, liftIO)++-- | A 'Sink' that hashes a stream of 'B.ByteString'@s@ and+-- creates a digest @d@.+sinkHash :: (Monad m, HashAlgorithm hash) => Consumer B.ByteString m (Digest hash)+sinkHash = sink hashInit+  where sink ctx = do+            b <- await+            case b of+                Nothing -> return $! hashFinalize ctx+                Just bs -> sink $! hashUpdate ctx bs++-- | 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')+-- @+hashFile :: (MonadIO m, HashAlgorithm hash) => FilePath -> m (Digest hash)+hashFile fp = liftIO $ runResourceT (sourceFile fp $$ sinkHash)
+ LICENSE view
@@ -0,0 +1,27 @@+Copyright (c) 2014 Vincent Hanquez <vincent@snarc.org>++All rights reserved.++Redistribution and use in source and binary forms, with or without+modification, are permitted provided that the following conditions+are met:+1. Redistributions of source code must retain the above copyright+   notice, this list of conditions and the following disclaimer.+2. Redistributions in binary form must reproduce the above copyright+   notice, this list of conditions and the following disclaimer in the+   documentation and/or other materials provided with the distribution.+3. Neither the name of the author nor the names of his contributors+   may be used to endorse or promote products derived from this software+   without specific prior written permission.++THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS AS IS'' AND+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE+ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE+FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL+DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS+OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)+HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT+LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY+OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF+SUCH DAMAGE.
+ README.md view
@@ -0,0 +1,4 @@+cryptohash-conduit+==================++Documentation: [cryptohash-conduit on hackage](http://hackage.haskell.org/package/cryptohash-conduit)
+ Setup.hs view
@@ -0,0 +1,2 @@+import Distribution.Simple+main = defaultMain
+ cryptohash-conduit.cabal view
@@ -0,0 +1,30 @@+Name:                cryptohash-conduit+Version:             0.1.0+Synopsis:            cryptohash conduit+Description:+  Support all the @cryptohash@ package using conduits from+  the @conduit@ package.+License:             BSD3+License-file:        LICENSE+Copyright:           Vincent Hanquez <vincent@snarc.org>+Author:              Vincent Hanquez <vincent@snarc.org>+Maintainer:          vincent@snarc.org+Category:            Cryptography, Conduit+Stability:           experimental+Build-Type:          Simple+Homepage:            http://github.com/vincenthz/hs-cryptohash-conduit+Cabal-Version:       >=1.8+Extra-source-files:  README.md++Library+  Exposed-modules:   Crypto.Hash.Conduit+  Build-depends:     base >= 4 && < 5+                   , bytestring+                   , conduit+                   , cryptohash+                   , transformers+  ghc-options:       -Wall -fwarn-tabs++source-repository head+  type: git+  location: git://github.com/vincenthz/hs-cryptohash-conduit