{-# LANGUAGE ForeignFunctionInterface #-}
{-# LANGUAGE DeriveDataTypeable #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE TypeFamilies #-}
module Crypto.Hash.SHA1 ( SHA1 (..) ) where
import Crypto.Hash.Types
import Foreign.Ptr (Ptr)
import Data.Data
import Data.Word (Word8, Word32)
data SHA1 = SHA1
deriving (Int -> SHA1 -> ShowS
[SHA1] -> ShowS
SHA1 -> String
(Int -> SHA1 -> ShowS)
-> (SHA1 -> String) -> ([SHA1] -> ShowS) -> Show SHA1
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SHA1] -> ShowS
$cshowList :: [SHA1] -> ShowS
show :: SHA1 -> String
$cshow :: SHA1 -> String
showsPrec :: Int -> SHA1 -> ShowS
$cshowsPrec :: Int -> SHA1 -> ShowS
Show,Typeable SHA1
DataType
Constr
Typeable SHA1
-> (forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> SHA1 -> c SHA1)
-> (forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c SHA1)
-> (SHA1 -> Constr)
-> (SHA1 -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c SHA1))
-> (forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c SHA1))
-> ((forall b. Data b => b -> b) -> SHA1 -> SHA1)
-> (forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> SHA1 -> r)
-> (forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> SHA1 -> r)
-> (forall u. (forall d. Data d => d -> u) -> SHA1 -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> SHA1 -> u)
-> (forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> SHA1 -> m SHA1)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> SHA1 -> m SHA1)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> SHA1 -> m SHA1)
-> Data SHA1
SHA1 -> DataType
SHA1 -> Constr
(forall b. Data b => b -> b) -> SHA1 -> SHA1
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> SHA1 -> c SHA1
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c SHA1
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) -> SHA1 -> u
forall u. (forall d. Data d => d -> u) -> SHA1 -> [u]
forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> SHA1 -> r
forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> SHA1 -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> SHA1 -> m SHA1
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> SHA1 -> m SHA1
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c SHA1
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> SHA1 -> c SHA1
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c SHA1)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c SHA1)
$cSHA1 :: Constr
$tSHA1 :: DataType
gmapMo :: (forall d. Data d => d -> m d) -> SHA1 -> m SHA1
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> SHA1 -> m SHA1
gmapMp :: (forall d. Data d => d -> m d) -> SHA1 -> m SHA1
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> SHA1 -> m SHA1
gmapM :: (forall d. Data d => d -> m d) -> SHA1 -> m SHA1
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> SHA1 -> m SHA1
gmapQi :: Int -> (forall d. Data d => d -> u) -> SHA1 -> u
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> SHA1 -> u
gmapQ :: (forall d. Data d => d -> u) -> SHA1 -> [u]
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> SHA1 -> [u]
gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> SHA1 -> r
$cgmapQr :: forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> SHA1 -> r
gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> SHA1 -> r
$cgmapQl :: forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> SHA1 -> r
gmapT :: (forall b. Data b => b -> b) -> SHA1 -> SHA1
$cgmapT :: (forall b. Data b => b -> b) -> SHA1 -> SHA1
dataCast2 :: (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c SHA1)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c SHA1)
dataCast1 :: (forall d. Data d => c (t d)) -> Maybe (c SHA1)
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c SHA1)
dataTypeOf :: SHA1 -> DataType
$cdataTypeOf :: SHA1 -> DataType
toConstr :: SHA1 -> Constr
$ctoConstr :: SHA1 -> Constr
gunfold :: (forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c SHA1
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c SHA1
gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> SHA1 -> c SHA1
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> SHA1 -> c SHA1
$cp1Data :: Typeable SHA1
Data)
instance HashAlgorithm SHA1 where
type HashBlockSize SHA1 = 64
type HashDigestSize SHA1 = 20
type HashInternalContextSize SHA1 = 96
hashBlockSize :: SHA1 -> Int
hashBlockSize SHA1
_ = Int
64
hashDigestSize :: SHA1 -> Int
hashDigestSize SHA1
_ = Int
20
hashInternalContextSize :: SHA1 -> Int
hashInternalContextSize SHA1
_ = Int
96
hashInternalInit :: Ptr (Context SHA1) -> IO ()
hashInternalInit = Ptr (Context SHA1) -> IO ()
forall a. Ptr (Context a) -> IO ()
c_sha1_init
hashInternalUpdate :: Ptr (Context SHA1) -> Ptr Word8 -> Word32 -> IO ()
hashInternalUpdate = Ptr (Context SHA1) -> Ptr Word8 -> Word32 -> IO ()
forall a. Ptr (Context a) -> Ptr Word8 -> Word32 -> IO ()
c_sha1_update
hashInternalFinalize :: Ptr (Context SHA1) -> Ptr (Digest SHA1) -> IO ()
hashInternalFinalize = Ptr (Context SHA1) -> Ptr (Digest SHA1) -> IO ()
forall a. Ptr (Context a) -> Ptr (Digest a) -> IO ()
c_sha1_finalize
foreign import ccall unsafe "cryptonite_sha1_init"
c_sha1_init :: Ptr (Context a)-> IO ()
foreign import ccall "cryptonite_sha1_update"
c_sha1_update :: Ptr (Context a) -> Ptr Word8 -> Word32 -> IO ()
foreign import ccall unsafe "cryptonite_sha1_finalize"
c_sha1_finalize :: Ptr (Context a) -> Ptr (Digest a) -> IO ()