Use crypto-conduit 0.1.1's hashFile in base64md5File.

This commit is contained in:
Felipe Lessa 2012-01-07 08:51:00 -02:00
parent af352c5ed0
commit 59c3705f7d
2 changed files with 4 additions and 5 deletions

View File

@ -57,7 +57,7 @@ import Data.List (intercalate)
import Language.Haskell.TH
import Language.Haskell.TH.Syntax
import Crypto.Conduit (sinkHash)
import Crypto.Conduit (hashFile)
import Crypto.Hash.MD5 (MD5)
import qualified Data.ByteString.Lazy as L
@ -314,9 +314,8 @@ mkStaticFilesList fp fs routeConName makeHash = do
]
base64md5File :: Prelude.FilePath -> IO String
base64md5File file = do
hash <- C.runResourceT $ CB.sourceFile file C.$$ sinkHash
return $ base64 $ Data.Serialize.encode (hash :: MD5)
base64md5File = fmap (base64 . encode) . hashFile
where encode d = Data.Serialize.encode (d :: MD5)
base64 :: MD5Digest -> String
base64 = map tr

View File

@ -40,7 +40,7 @@ library
, http-types >= 0.6.5 && < 0.7
, unix-compat >= 0.2
, conduit >= 0.0
, crypto-conduit >= 0.1 && < 0.2
, crypto-conduit >= 0.1.1 && < 0.2
, cryptohash >= 0.6.1
exposed-modules: Yesod.Static
ghc-options: -Wall