module Crypto.Hash.Types
( Context(..)
, Digest(..)
, contextToByteString
, digestToByteString
)
where
import Data.ByteString (ByteString)
import Data.Byteable
import qualified Data.ByteArray as B (convert)
import qualified "cryptonite" Crypto.Hash as H
newtype Context a = Context (H.Context a)
instance Byteable (Context a) where
toBytes (Context ctx) = B.convert ctx
contextToByteString :: Context a -> ByteString
contextToByteString = toBytes
newtype Digest a = Digest (H.Digest a)
deriving (Eq,Ord)
instance Byteable (Digest a) where
toBytes (Digest dig) = B.convert dig
digestToByteString :: Digest a -> ByteString
digestToByteString = toBytes
instance Show (Digest a) where
show (Digest dig) = show dig