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

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


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

instance HashAlgorithm Blake2s_160 where
    type HashBlockSize           Blake2s_160 = 64
    type HashDigestSize          Blake2s_160 = 20
    type HashInternalContextSize Blake2s_160 = 136
    hashBlockSize :: Blake2s_160 -> Int
hashBlockSize  Blake2s_160
_          = Int
64
    hashDigestSize :: Blake2s_160 -> Int
hashDigestSize Blake2s_160
_          = Int
20
    hashInternalContextSize :: Blake2s_160 -> Int
hashInternalContextSize Blake2s_160
_ = Int
136
    hashInternalInit :: Ptr (Context Blake2s_160) -> IO ()
hashInternalInit Ptr (Context Blake2s_160)
p        = Ptr (Context Blake2s_160) -> Word32 -> IO ()
forall a. Ptr (Context a) -> Word32 -> IO ()
c_blake2s_init Ptr (Context Blake2s_160)
p Word32
160
    hashInternalUpdate :: Ptr (Context Blake2s_160) -> Ptr Word8 -> Word32 -> IO ()
hashInternalUpdate        = Ptr (Context Blake2s_160) -> Ptr Word8 -> Word32 -> IO ()
forall a. Ptr (Context a) -> Ptr Word8 -> Word32 -> IO ()
c_blake2s_update
    hashInternalFinalize :: Ptr (Context Blake2s_160) -> Ptr (Digest Blake2s_160) -> IO ()
hashInternalFinalize Ptr (Context Blake2s_160)
p    = Ptr (Context Blake2s_160)
-> Word32 -> Ptr (Digest Blake2s_160) -> IO ()
forall a. Ptr (Context a) -> Word32 -> Ptr (Digest a) -> IO ()
c_blake2s_finalize Ptr (Context Blake2s_160)
p Word32
160

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

instance HashAlgorithm Blake2s_224 where
    type HashBlockSize           Blake2s_224 = 64
    type HashDigestSize          Blake2s_224 = 28
    type HashInternalContextSize Blake2s_224 = 136
    hashBlockSize :: Blake2s_224 -> Int
hashBlockSize  Blake2s_224
_          = Int
64
    hashDigestSize :: Blake2s_224 -> Int
hashDigestSize Blake2s_224
_          = Int
28
    hashInternalContextSize :: Blake2s_224 -> Int
hashInternalContextSize Blake2s_224
_ = Int
136
    hashInternalInit :: Ptr (Context Blake2s_224) -> IO ()
hashInternalInit Ptr (Context Blake2s_224)
p        = Ptr (Context Blake2s_224) -> Word32 -> IO ()
forall a. Ptr (Context a) -> Word32 -> IO ()
c_blake2s_init Ptr (Context Blake2s_224)
p Word32
224
    hashInternalUpdate :: Ptr (Context Blake2s_224) -> Ptr Word8 -> Word32 -> IO ()
hashInternalUpdate        = Ptr (Context Blake2s_224) -> Ptr Word8 -> Word32 -> IO ()
forall a. Ptr (Context a) -> Ptr Word8 -> Word32 -> IO ()
c_blake2s_update
    hashInternalFinalize :: Ptr (Context Blake2s_224) -> Ptr (Digest Blake2s_224) -> IO ()
hashInternalFinalize Ptr (Context Blake2s_224)
p    = Ptr (Context Blake2s_224)
-> Word32 -> Ptr (Digest Blake2s_224) -> IO ()
forall a. Ptr (Context a) -> Word32 -> Ptr (Digest a) -> IO ()
c_blake2s_finalize Ptr (Context Blake2s_224)
p Word32
224

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

instance HashAlgorithm Blake2s_256 where
    type HashBlockSize           Blake2s_256 = 64
    type HashDigestSize          Blake2s_256 = 32
    type HashInternalContextSize Blake2s_256 = 136
    hashBlockSize :: Blake2s_256 -> Int
hashBlockSize  Blake2s_256
_          = Int
64
    hashDigestSize :: Blake2s_256 -> Int
hashDigestSize Blake2s_256
_          = Int
32
    hashInternalContextSize :: Blake2s_256 -> Int
hashInternalContextSize Blake2s_256
_ = Int
136
    hashInternalInit :: Ptr (Context Blake2s_256) -> IO ()
hashInternalInit Ptr (Context Blake2s_256)
p        = Ptr (Context Blake2s_256) -> Word32 -> IO ()
forall a. Ptr (Context a) -> Word32 -> IO ()
c_blake2s_init Ptr (Context Blake2s_256)
p Word32
256
    hashInternalUpdate :: Ptr (Context Blake2s_256) -> Ptr Word8 -> Word32 -> IO ()
hashInternalUpdate        = Ptr (Context Blake2s_256) -> Ptr Word8 -> Word32 -> IO ()
forall a. Ptr (Context a) -> Ptr Word8 -> Word32 -> IO ()
c_blake2s_update
    hashInternalFinalize :: Ptr (Context Blake2s_256) -> Ptr (Digest Blake2s_256) -> IO ()
hashInternalFinalize Ptr (Context Blake2s_256)
p    = Ptr (Context Blake2s_256)
-> Word32 -> Ptr (Digest Blake2s_256) -> IO ()
forall a. Ptr (Context a) -> Word32 -> Ptr (Digest a) -> IO ()
c_blake2s_finalize Ptr (Context Blake2s_256)
p Word32
256


foreign import ccall unsafe "crypton_blake2s_init"
    c_blake2s_init :: Ptr (Context a) -> Word32 -> IO ()

foreign import ccall "crypton_blake2s_update"
    c_blake2s_update :: Ptr (Context a) -> Ptr Word8 -> Word32 -> IO ()

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