-- File created: 2008-03-23 21:46:37

module Coadjute.Hash (Hash, hashFile, showHash, readHash) where

import qualified Data.Digest.Pure.MD5 as MD5
import qualified Data.ByteString.Lazy as BS

-- depends on what's most convenient with the hash library used
type Hash = String

hashFile :: FilePath -> IO Hash
hashFile = fmap (show . MD5.md5) . BS.readFile

showHash :: Hash -> String
showHash = id

-- |The length of the input string must be 32. This is not checked.
readHash :: String -> Hash
readHash = id