-- |
-- Module      : Crypto.Hash.Keccak
-- License     : BSD-style
-- Maintainer  : Vincent Hanquez <vincent@snarc.org>
-- Stability   : experimental
-- Portability : unknown
--
-- Module containing the binding functions to work with the
-- Keccak cryptographic hash.
--
{-# LANGUAGE ForeignFunctionInterface #-}
{-# LANGUAGE DeriveDataTypeable #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE TypeFamilies #-}
module Crypto.Hash.Keccak
    (  Keccak_224 (..), Keccak_256 (..), Keccak_384 (..), Keccak_512 (..)
    ) where

import           Crypto.Hash.Types
import           Foreign.Ptr (Ptr)
import           Data.Data
import           Data.Word (Word8, Word32)


-- | Keccak (224 bits) cryptographic hash algorithm
data Keccak_224 = Keccak_224
    deriving (Int -> Keccak_224 -> ShowS
[Keccak_224] -> ShowS
Keccak_224 -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Keccak_224] -> ShowS
$cshowList :: [Keccak_224] -> ShowS
show :: Keccak_224 -> String
$cshow :: Keccak_224 -> String
showsPrec :: Int -> Keccak_224 -> ShowS
$cshowsPrec :: Int -> Keccak_224 -> ShowS
Show,Typeable Keccak_224
Keccak_224 -> DataType
Keccak_224 -> Constr
(forall b. Data b => b -> b) -> Keccak_224 -> Keccak_224
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) -> Keccak_224 -> u
forall u. (forall d. Data d => d -> u) -> Keccak_224 -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> Keccak_224 -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> Keccak_224 -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> Keccak_224 -> m Keccak_224
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Keccak_224 -> m Keccak_224
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Keccak_224
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Keccak_224 -> c Keccak_224
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c Keccak_224)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Keccak_224)
gmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Keccak_224 -> m Keccak_224
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Keccak_224 -> m Keccak_224
gmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Keccak_224 -> m Keccak_224
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Keccak_224 -> m Keccak_224
gmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> Keccak_224 -> m Keccak_224
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> Keccak_224 -> m Keccak_224
gmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> Keccak_224 -> u
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> Keccak_224 -> u
gmapQ :: forall u. (forall d. Data d => d -> u) -> Keccak_224 -> [u]
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> Keccak_224 -> [u]
gmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> Keccak_224 -> r
$cgmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> Keccak_224 -> r
gmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> Keccak_224 -> r
$cgmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> Keccak_224 -> r
gmapT :: (forall b. Data b => b -> b) -> Keccak_224 -> Keccak_224
$cgmapT :: (forall b. Data b => b -> b) -> Keccak_224 -> Keccak_224
dataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Keccak_224)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Keccak_224)
dataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c Keccak_224)
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c Keccak_224)
dataTypeOf :: Keccak_224 -> DataType
$cdataTypeOf :: Keccak_224 -> DataType
toConstr :: Keccak_224 -> Constr
$ctoConstr :: Keccak_224 -> Constr
gunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Keccak_224
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Keccak_224
gfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Keccak_224 -> c Keccak_224
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Keccak_224 -> c Keccak_224
Data)

instance HashAlgorithm Keccak_224 where
    type HashBlockSize           Keccak_224 = 144
    type HashDigestSize          Keccak_224 = 28
    type HashInternalContextSize Keccak_224 = 352
    hashBlockSize :: Keccak_224 -> Int
hashBlockSize  Keccak_224
_          = Int
144
    hashDigestSize :: Keccak_224 -> Int
hashDigestSize Keccak_224
_          = Int
28
    hashInternalContextSize :: Keccak_224 -> Int
hashInternalContextSize Keccak_224
_ = Int
352
    hashInternalInit :: Ptr (Context Keccak_224) -> IO ()
hashInternalInit Ptr (Context Keccak_224)
p        = forall a. Ptr (Context a) -> Word32 -> IO ()
c_keccak_init Ptr (Context Keccak_224)
p Word32
224
    hashInternalUpdate :: Ptr (Context Keccak_224) -> Ptr Word8 -> Word32 -> IO ()
hashInternalUpdate        = forall a. Ptr (Context a) -> Ptr Word8 -> Word32 -> IO ()
c_keccak_update
    hashInternalFinalize :: Ptr (Context Keccak_224) -> Ptr (Digest Keccak_224) -> IO ()
hashInternalFinalize Ptr (Context Keccak_224)
p    = forall a. Ptr (Context a) -> Word32 -> Ptr (Digest a) -> IO ()
c_keccak_finalize Ptr (Context Keccak_224)
p Word32
224

-- | Keccak (256 bits) cryptographic hash algorithm
data Keccak_256 = Keccak_256
    deriving (Int -> Keccak_256 -> ShowS
[Keccak_256] -> ShowS
Keccak_256 -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Keccak_256] -> ShowS
$cshowList :: [Keccak_256] -> ShowS
show :: Keccak_256 -> String
$cshow :: Keccak_256 -> String
showsPrec :: Int -> Keccak_256 -> ShowS
$cshowsPrec :: Int -> Keccak_256 -> ShowS
Show,Typeable Keccak_256
Keccak_256 -> DataType
Keccak_256 -> Constr
(forall b. Data b => b -> b) -> Keccak_256 -> Keccak_256
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) -> Keccak_256 -> u
forall u. (forall d. Data d => d -> u) -> Keccak_256 -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> Keccak_256 -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> Keccak_256 -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> Keccak_256 -> m Keccak_256
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Keccak_256 -> m Keccak_256
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Keccak_256
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Keccak_256 -> c Keccak_256
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c Keccak_256)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Keccak_256)
gmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Keccak_256 -> m Keccak_256
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Keccak_256 -> m Keccak_256
gmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Keccak_256 -> m Keccak_256
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Keccak_256 -> m Keccak_256
gmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> Keccak_256 -> m Keccak_256
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> Keccak_256 -> m Keccak_256
gmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> Keccak_256 -> u
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> Keccak_256 -> u
gmapQ :: forall u. (forall d. Data d => d -> u) -> Keccak_256 -> [u]
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> Keccak_256 -> [u]
gmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> Keccak_256 -> r
$cgmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> Keccak_256 -> r
gmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> Keccak_256 -> r
$cgmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> Keccak_256 -> r
gmapT :: (forall b. Data b => b -> b) -> Keccak_256 -> Keccak_256
$cgmapT :: (forall b. Data b => b -> b) -> Keccak_256 -> Keccak_256
dataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Keccak_256)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Keccak_256)
dataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c Keccak_256)
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c Keccak_256)
dataTypeOf :: Keccak_256 -> DataType
$cdataTypeOf :: Keccak_256 -> DataType
toConstr :: Keccak_256 -> Constr
$ctoConstr :: Keccak_256 -> Constr
gunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Keccak_256
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Keccak_256
gfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Keccak_256 -> c Keccak_256
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Keccak_256 -> c Keccak_256
Data)

instance HashAlgorithm Keccak_256 where
    type HashBlockSize           Keccak_256 = 136
    type HashDigestSize          Keccak_256 = 32
    type HashInternalContextSize Keccak_256 = 344
    hashBlockSize :: Keccak_256 -> Int
hashBlockSize  Keccak_256
_          = Int
136
    hashDigestSize :: Keccak_256 -> Int
hashDigestSize Keccak_256
_          = Int
32
    hashInternalContextSize :: Keccak_256 -> Int
hashInternalContextSize Keccak_256
_ = Int
344
    hashInternalInit :: Ptr (Context Keccak_256) -> IO ()
hashInternalInit Ptr (Context Keccak_256)
p        = forall a. Ptr (Context a) -> Word32 -> IO ()
c_keccak_init Ptr (Context Keccak_256)
p Word32
256
    hashInternalUpdate :: Ptr (Context Keccak_256) -> Ptr Word8 -> Word32 -> IO ()
hashInternalUpdate        = forall a. Ptr (Context a) -> Ptr Word8 -> Word32 -> IO ()
c_keccak_update
    hashInternalFinalize :: Ptr (Context Keccak_256) -> Ptr (Digest Keccak_256) -> IO ()
hashInternalFinalize Ptr (Context Keccak_256)
p    = forall a. Ptr (Context a) -> Word32 -> Ptr (Digest a) -> IO ()
c_keccak_finalize Ptr (Context Keccak_256)
p Word32
256

-- | Keccak (384 bits) cryptographic hash algorithm
data Keccak_384 = Keccak_384
    deriving (Int -> Keccak_384 -> ShowS
[Keccak_384] -> ShowS
Keccak_384 -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Keccak_384] -> ShowS
$cshowList :: [Keccak_384] -> ShowS
show :: Keccak_384 -> String
$cshow :: Keccak_384 -> String
showsPrec :: Int -> Keccak_384 -> ShowS
$cshowsPrec :: Int -> Keccak_384 -> ShowS
Show,Typeable Keccak_384
Keccak_384 -> DataType
Keccak_384 -> Constr
(forall b. Data b => b -> b) -> Keccak_384 -> Keccak_384
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) -> Keccak_384 -> u
forall u. (forall d. Data d => d -> u) -> Keccak_384 -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> Keccak_384 -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> Keccak_384 -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> Keccak_384 -> m Keccak_384
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Keccak_384 -> m Keccak_384
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Keccak_384
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Keccak_384 -> c Keccak_384
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c Keccak_384)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Keccak_384)
gmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Keccak_384 -> m Keccak_384
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Keccak_384 -> m Keccak_384
gmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Keccak_384 -> m Keccak_384
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Keccak_384 -> m Keccak_384
gmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> Keccak_384 -> m Keccak_384
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> Keccak_384 -> m Keccak_384
gmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> Keccak_384 -> u
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> Keccak_384 -> u
gmapQ :: forall u. (forall d. Data d => d -> u) -> Keccak_384 -> [u]
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> Keccak_384 -> [u]
gmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> Keccak_384 -> r
$cgmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> Keccak_384 -> r
gmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> Keccak_384 -> r
$cgmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> Keccak_384 -> r
gmapT :: (forall b. Data b => b -> b) -> Keccak_384 -> Keccak_384
$cgmapT :: (forall b. Data b => b -> b) -> Keccak_384 -> Keccak_384
dataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Keccak_384)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Keccak_384)
dataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c Keccak_384)
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c Keccak_384)
dataTypeOf :: Keccak_384 -> DataType
$cdataTypeOf :: Keccak_384 -> DataType
toConstr :: Keccak_384 -> Constr
$ctoConstr :: Keccak_384 -> Constr
gunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Keccak_384
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Keccak_384
gfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Keccak_384 -> c Keccak_384
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Keccak_384 -> c Keccak_384
Data)

instance HashAlgorithm Keccak_384 where
    type HashBlockSize           Keccak_384 = 104
    type HashDigestSize          Keccak_384 = 48
    type HashInternalContextSize Keccak_384 = 312
    hashBlockSize :: Keccak_384 -> Int
hashBlockSize  Keccak_384
_          = Int
104
    hashDigestSize :: Keccak_384 -> Int
hashDigestSize Keccak_384
_          = Int
48
    hashInternalContextSize :: Keccak_384 -> Int
hashInternalContextSize Keccak_384
_ = Int
312
    hashInternalInit :: Ptr (Context Keccak_384) -> IO ()
hashInternalInit Ptr (Context Keccak_384)
p        = forall a. Ptr (Context a) -> Word32 -> IO ()
c_keccak_init Ptr (Context Keccak_384)
p Word32
384
    hashInternalUpdate :: Ptr (Context Keccak_384) -> Ptr Word8 -> Word32 -> IO ()
hashInternalUpdate        = forall a. Ptr (Context a) -> Ptr Word8 -> Word32 -> IO ()
c_keccak_update
    hashInternalFinalize :: Ptr (Context Keccak_384) -> Ptr (Digest Keccak_384) -> IO ()
hashInternalFinalize Ptr (Context Keccak_384)
p    = forall a. Ptr (Context a) -> Word32 -> Ptr (Digest a) -> IO ()
c_keccak_finalize Ptr (Context Keccak_384)
p Word32
384

-- | Keccak (512 bits) cryptographic hash algorithm
data Keccak_512 = Keccak_512
    deriving (Int -> Keccak_512 -> ShowS
[Keccak_512] -> ShowS
Keccak_512 -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Keccak_512] -> ShowS
$cshowList :: [Keccak_512] -> ShowS
show :: Keccak_512 -> String
$cshow :: Keccak_512 -> String
showsPrec :: Int -> Keccak_512 -> ShowS
$cshowsPrec :: Int -> Keccak_512 -> ShowS
Show,Typeable Keccak_512
Keccak_512 -> DataType
Keccak_512 -> Constr
(forall b. Data b => b -> b) -> Keccak_512 -> Keccak_512
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) -> Keccak_512 -> u
forall u. (forall d. Data d => d -> u) -> Keccak_512 -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> Keccak_512 -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> Keccak_512 -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> Keccak_512 -> m Keccak_512
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Keccak_512 -> m Keccak_512
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Keccak_512
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Keccak_512 -> c Keccak_512
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c Keccak_512)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Keccak_512)
gmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Keccak_512 -> m Keccak_512
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Keccak_512 -> m Keccak_512
gmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Keccak_512 -> m Keccak_512
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Keccak_512 -> m Keccak_512
gmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> Keccak_512 -> m Keccak_512
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> Keccak_512 -> m Keccak_512
gmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> Keccak_512 -> u
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> Keccak_512 -> u
gmapQ :: forall u. (forall d. Data d => d -> u) -> Keccak_512 -> [u]
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> Keccak_512 -> [u]
gmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> Keccak_512 -> r
$cgmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> Keccak_512 -> r
gmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> Keccak_512 -> r
$cgmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> Keccak_512 -> r
gmapT :: (forall b. Data b => b -> b) -> Keccak_512 -> Keccak_512
$cgmapT :: (forall b. Data b => b -> b) -> Keccak_512 -> Keccak_512
dataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Keccak_512)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Keccak_512)
dataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c Keccak_512)
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c Keccak_512)
dataTypeOf :: Keccak_512 -> DataType
$cdataTypeOf :: Keccak_512 -> DataType
toConstr :: Keccak_512 -> Constr
$ctoConstr :: Keccak_512 -> Constr
gunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Keccak_512
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Keccak_512
gfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Keccak_512 -> c Keccak_512
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Keccak_512 -> c Keccak_512
Data)

instance HashAlgorithm Keccak_512 where
    type HashBlockSize           Keccak_512 = 72
    type HashDigestSize          Keccak_512 = 64
    type HashInternalContextSize Keccak_512 = 280
    hashBlockSize :: Keccak_512 -> Int
hashBlockSize  Keccak_512
_          = Int
72
    hashDigestSize :: Keccak_512 -> Int
hashDigestSize Keccak_512
_          = Int
64
    hashInternalContextSize :: Keccak_512 -> Int
hashInternalContextSize Keccak_512
_ = Int
280
    hashInternalInit :: Ptr (Context Keccak_512) -> IO ()
hashInternalInit Ptr (Context Keccak_512)
p        = forall a. Ptr (Context a) -> Word32 -> IO ()
c_keccak_init Ptr (Context Keccak_512)
p Word32
512
    hashInternalUpdate :: Ptr (Context Keccak_512) -> Ptr Word8 -> Word32 -> IO ()
hashInternalUpdate        = forall a. Ptr (Context a) -> Ptr Word8 -> Word32 -> IO ()
c_keccak_update
    hashInternalFinalize :: Ptr (Context Keccak_512) -> Ptr (Digest Keccak_512) -> IO ()
hashInternalFinalize Ptr (Context Keccak_512)
p    = forall a. Ptr (Context a) -> Word32 -> Ptr (Digest a) -> IO ()
c_keccak_finalize Ptr (Context Keccak_512)
p Word32
512


foreign import ccall unsafe "crypton_keccak_init"
    c_keccak_init :: Ptr (Context a) -> Word32 -> IO ()

foreign import ccall "crypton_keccak_update"
    c_keccak_update :: Ptr (Context a) -> Ptr Word8 -> Word32 -> IO ()

foreign import ccall unsafe "crypton_keccak_finalize"
    c_keccak_finalize :: Ptr (Context a) -> Word32 -> Ptr (Digest a) -> IO ()