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