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

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


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

instance HashAlgorithm Skein512_224 where
    type HashBlockSize           Skein512_224 = 64
    type HashDigestSize          Skein512_224 = 28
    type HashInternalContextSize Skein512_224 = 160
    hashBlockSize :: Skein512_224 -> Int
hashBlockSize  Skein512_224
_          = Int
64
    hashDigestSize :: Skein512_224 -> Int
hashDigestSize Skein512_224
_          = Int
28
    hashInternalContextSize :: Skein512_224 -> Int
hashInternalContextSize Skein512_224
_ = Int
160
    hashInternalInit :: Ptr (Context Skein512_224) -> IO ()
hashInternalInit Ptr (Context Skein512_224)
p        = Ptr (Context Skein512_224) -> Word32 -> IO ()
forall a. Ptr (Context a) -> Word32 -> IO ()
c_skein512_init Ptr (Context Skein512_224)
p Word32
224
    hashInternalUpdate :: Ptr (Context Skein512_224) -> Ptr Word8 -> Word32 -> IO ()
hashInternalUpdate        = Ptr (Context Skein512_224) -> Ptr Word8 -> Word32 -> IO ()
forall a. Ptr (Context a) -> Ptr Word8 -> Word32 -> IO ()
c_skein512_update
    hashInternalFinalize :: Ptr (Context Skein512_224) -> Ptr (Digest Skein512_224) -> IO ()
hashInternalFinalize Ptr (Context Skein512_224)
p    = Ptr (Context Skein512_224)
-> Word32 -> Ptr (Digest Skein512_224) -> IO ()
forall a. Ptr (Context a) -> Word32 -> Ptr (Digest a) -> IO ()
c_skein512_finalize Ptr (Context Skein512_224)
p Word32
224

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

instance HashAlgorithm Skein512_256 where
    type HashBlockSize           Skein512_256 = 64
    type HashDigestSize          Skein512_256 = 32
    type HashInternalContextSize Skein512_256 = 160
    hashBlockSize :: Skein512_256 -> Int
hashBlockSize  Skein512_256
_          = Int
64
    hashDigestSize :: Skein512_256 -> Int
hashDigestSize Skein512_256
_          = Int
32
    hashInternalContextSize :: Skein512_256 -> Int
hashInternalContextSize Skein512_256
_ = Int
160
    hashInternalInit :: Ptr (Context Skein512_256) -> IO ()
hashInternalInit Ptr (Context Skein512_256)
p        = Ptr (Context Skein512_256) -> Word32 -> IO ()
forall a. Ptr (Context a) -> Word32 -> IO ()
c_skein512_init Ptr (Context Skein512_256)
p Word32
256
    hashInternalUpdate :: Ptr (Context Skein512_256) -> Ptr Word8 -> Word32 -> IO ()
hashInternalUpdate        = Ptr (Context Skein512_256) -> Ptr Word8 -> Word32 -> IO ()
forall a. Ptr (Context a) -> Ptr Word8 -> Word32 -> IO ()
c_skein512_update
    hashInternalFinalize :: Ptr (Context Skein512_256) -> Ptr (Digest Skein512_256) -> IO ()
hashInternalFinalize Ptr (Context Skein512_256)
p    = Ptr (Context Skein512_256)
-> Word32 -> Ptr (Digest Skein512_256) -> IO ()
forall a. Ptr (Context a) -> Word32 -> Ptr (Digest a) -> IO ()
c_skein512_finalize Ptr (Context Skein512_256)
p Word32
256

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

instance HashAlgorithm Skein512_384 where
    type HashBlockSize           Skein512_384 = 64
    type HashDigestSize          Skein512_384 = 48
    type HashInternalContextSize Skein512_384 = 160
    hashBlockSize :: Skein512_384 -> Int
hashBlockSize  Skein512_384
_          = Int
64
    hashDigestSize :: Skein512_384 -> Int
hashDigestSize Skein512_384
_          = Int
48
    hashInternalContextSize :: Skein512_384 -> Int
hashInternalContextSize Skein512_384
_ = Int
160
    hashInternalInit :: Ptr (Context Skein512_384) -> IO ()
hashInternalInit Ptr (Context Skein512_384)
p        = Ptr (Context Skein512_384) -> Word32 -> IO ()
forall a. Ptr (Context a) -> Word32 -> IO ()
c_skein512_init Ptr (Context Skein512_384)
p Word32
384
    hashInternalUpdate :: Ptr (Context Skein512_384) -> Ptr Word8 -> Word32 -> IO ()
hashInternalUpdate        = Ptr (Context Skein512_384) -> Ptr Word8 -> Word32 -> IO ()
forall a. Ptr (Context a) -> Ptr Word8 -> Word32 -> IO ()
c_skein512_update
    hashInternalFinalize :: Ptr (Context Skein512_384) -> Ptr (Digest Skein512_384) -> IO ()
hashInternalFinalize Ptr (Context Skein512_384)
p    = Ptr (Context Skein512_384)
-> Word32 -> Ptr (Digest Skein512_384) -> IO ()
forall a. Ptr (Context a) -> Word32 -> Ptr (Digest a) -> IO ()
c_skein512_finalize Ptr (Context Skein512_384)
p Word32
384

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

instance HashAlgorithm Skein512_512 where
    type HashBlockSize           Skein512_512 = 64
    type HashDigestSize          Skein512_512 = 64
    type HashInternalContextSize Skein512_512 = 160
    hashBlockSize :: Skein512_512 -> Int
hashBlockSize  Skein512_512
_          = Int
64
    hashDigestSize :: Skein512_512 -> Int
hashDigestSize Skein512_512
_          = Int
64
    hashInternalContextSize :: Skein512_512 -> Int
hashInternalContextSize Skein512_512
_ = Int
160
    hashInternalInit :: Ptr (Context Skein512_512) -> IO ()
hashInternalInit Ptr (Context Skein512_512)
p        = Ptr (Context Skein512_512) -> Word32 -> IO ()
forall a. Ptr (Context a) -> Word32 -> IO ()
c_skein512_init Ptr (Context Skein512_512)
p Word32
512
    hashInternalUpdate :: Ptr (Context Skein512_512) -> Ptr Word8 -> Word32 -> IO ()
hashInternalUpdate        = Ptr (Context Skein512_512) -> Ptr Word8 -> Word32 -> IO ()
forall a. Ptr (Context a) -> Ptr Word8 -> Word32 -> IO ()
c_skein512_update
    hashInternalFinalize :: Ptr (Context Skein512_512) -> Ptr (Digest Skein512_512) -> IO ()
hashInternalFinalize Ptr (Context Skein512_512)
p    = Ptr (Context Skein512_512)
-> Word32 -> Ptr (Digest Skein512_512) -> IO ()
forall a. Ptr (Context a) -> Word32 -> Ptr (Digest a) -> IO ()
c_skein512_finalize Ptr (Context Skein512_512)
p Word32
512


foreign import ccall unsafe "cryptonite_skein512_init"
    c_skein512_init :: Ptr (Context a) -> Word32 -> IO ()

foreign import ccall "cryptonite_skein512_update"
    c_skein512_update :: Ptr (Context a) -> Ptr Word8 -> Word32 -> IO ()

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