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