{-# LANGUAGE ForeignFunctionInterface #-}
{-# LANGUAGE DeriveDataTypeable #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE TypeFamilies #-}
module Crypto.Hash.MD5 ( MD5 (..) ) where
import Crypto.Hash.Types
import Foreign.Ptr (Ptr)
import Data.Data
import Data.Word (Word8, Word32)
data MD5 = MD5
deriving (Int -> MD5 -> ShowS
[MD5] -> ShowS
MD5 -> String
(Int -> MD5 -> ShowS)
-> (MD5 -> String) -> ([MD5] -> ShowS) -> Show MD5
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> MD5 -> ShowS
showsPrec :: Int -> MD5 -> ShowS
$cshow :: MD5 -> String
show :: MD5 -> String
$cshowList :: [MD5] -> ShowS
showList :: [MD5] -> ShowS
Show,Typeable MD5
Typeable MD5 =>
(forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> MD5 -> c MD5)
-> (forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c MD5)
-> (MD5 -> Constr)
-> (MD5 -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c MD5))
-> (forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c MD5))
-> ((forall b. Data b => b -> b) -> MD5 -> MD5)
-> (forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> MD5 -> r)
-> (forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> MD5 -> r)
-> (forall u. (forall d. Data d => d -> u) -> MD5 -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> MD5 -> u)
-> (forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> MD5 -> m MD5)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> MD5 -> m MD5)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> MD5 -> m MD5)
-> Data MD5
MD5 -> Constr
MD5 -> DataType
(forall b. Data b => b -> b) -> MD5 -> MD5
forall a.
Typeable a =>
(forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall u. Int -> (forall d. Data d => d -> u) -> MD5 -> u
forall u. (forall d. Data d => d -> u) -> MD5 -> [u]
forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> MD5 -> r
forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> MD5 -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> MD5 -> m MD5
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> MD5 -> m MD5
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c MD5
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> MD5 -> c MD5
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c MD5)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c MD5)
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> MD5 -> c MD5
gfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> MD5 -> c MD5
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c MD5
gunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c MD5
$ctoConstr :: MD5 -> Constr
toConstr :: MD5 -> Constr
$cdataTypeOf :: MD5 -> DataType
dataTypeOf :: MD5 -> DataType
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c MD5)
dataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c MD5)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c MD5)
dataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c MD5)
$cgmapT :: (forall b. Data b => b -> b) -> MD5 -> MD5
gmapT :: (forall b. Data b => b -> b) -> MD5 -> MD5
$cgmapQl :: forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> MD5 -> r
gmapQl :: forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> MD5 -> r
$cgmapQr :: forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> MD5 -> r
gmapQr :: forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> MD5 -> r
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> MD5 -> [u]
gmapQ :: forall u. (forall d. Data d => d -> u) -> MD5 -> [u]
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> MD5 -> u
gmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> MD5 -> u
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> MD5 -> m MD5
gmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> MD5 -> m MD5
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> MD5 -> m MD5
gmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> MD5 -> m MD5
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> MD5 -> m MD5
gmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> MD5 -> m MD5
Data)
instance HashAlgorithm MD5 where
type HashBlockSize MD5 = 64
type HashDigestSize MD5 = 16
type HashInternalContextSize MD5 = 96
hashBlockSize :: MD5 -> Int
hashBlockSize MD5
_ = Int
64
hashDigestSize :: MD5 -> Int
hashDigestSize MD5
_ = Int
16
hashInternalContextSize :: MD5 -> Int
hashInternalContextSize MD5
_ = Int
96
hashInternalInit :: Ptr (Context MD5) -> IO ()
hashInternalInit = Ptr (Context MD5) -> IO ()
forall a. Ptr (Context a) -> IO ()
c_md5_init
hashInternalUpdate :: Ptr (Context MD5) -> Ptr Word8 -> Word32 -> IO ()
hashInternalUpdate = Ptr (Context MD5) -> Ptr Word8 -> Word32 -> IO ()
forall a. Ptr (Context a) -> Ptr Word8 -> Word32 -> IO ()
c_md5_update
hashInternalFinalize :: Ptr (Context MD5) -> Ptr (Digest MD5) -> IO ()
hashInternalFinalize = Ptr (Context MD5) -> Ptr (Digest MD5) -> IO ()
forall a. Ptr (Context a) -> Ptr (Digest a) -> IO ()
c_md5_finalize
instance HashAlgorithmPrefix MD5 where
hashInternalFinalizePrefix :: Ptr (Context MD5)
-> Ptr Word8 -> Word32 -> Word32 -> Ptr (Digest MD5) -> IO ()
hashInternalFinalizePrefix = Ptr (Context MD5)
-> Ptr Word8 -> Word32 -> Word32 -> Ptr (Digest MD5) -> IO ()
forall a.
Ptr (Context a)
-> Ptr Word8 -> Word32 -> Word32 -> Ptr (Digest a) -> IO ()
c_md5_finalize_prefix
foreign import ccall unsafe "cryptonite_md5_init"
c_md5_init :: Ptr (Context a)-> IO ()
foreign import ccall "cryptonite_md5_update"
c_md5_update :: Ptr (Context a) -> Ptr Word8 -> Word32 -> IO ()
foreign import ccall unsafe "cryptonite_md5_finalize"
c_md5_finalize :: Ptr (Context a) -> Ptr (Digest a) -> IO ()
foreign import ccall "cryptonite_md5_finalize_prefix"
c_md5_finalize_prefix :: Ptr (Context a) -> Ptr Word8 -> Word32 -> Word32 -> Ptr (Digest a) -> IO ()