{-# LANGUAGE DataKinds #-}
{-# LANGUAGE PackageImports #-}
{-# LANGUAGE TypeFamilies #-}
module Cardano.Crypto.Hash.MD5
( MD5
)
where
import Cardano.Crypto.Hash.Class
import qualified "cryptonite" Crypto.Hash as H
import qualified Data.ByteArray as BA
data MD5
instance HashAlgorithm MD5 where
type SizeHash MD5 = 16
hashAlgorithmName :: proxy MD5 -> String
hashAlgorithmName proxy MD5
_ = String
"md5"
digest :: proxy MD5 -> ByteString -> ByteString
digest proxy MD5
_ = Digest MD5 -> ByteString
convert (Digest MD5 -> ByteString)
-> (ByteString -> Digest MD5) -> ByteString -> ByteString
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ByteString -> Digest MD5
forall ba a.
(ByteArrayAccess ba, HashAlgorithm a) =>
ba -> Digest a
H.hash
convert :: H.Digest H.MD5 -> ByteString
convert :: Digest MD5 -> ByteString
convert = Digest MD5 -> ByteString
forall bin bout.
(ByteArrayAccess bin, ByteArray bout) =>
bin -> bout
BA.convert