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

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

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

    instance HashAlgorithm Tiger where
        type HashBlockSize           Tiger = 64
        type HashDigestSize          Tiger = 24
        type HashInternalContextSize Tiger = 96
        hashBlockSize :: Tiger -> Int
    hashBlockSize  _          = 64
        hashDigestSize :: Tiger -> Int
    hashDigestSize _          = 24
        hashInternalContextSize :: Tiger -> Int
    hashInternalContextSize _ = 96
        hashInternalInit :: Ptr (Context Tiger) -> IO ()
    hashInternalInit          = Ptr (Context Tiger) -> IO ()
    forall a. Ptr (Context a) -> IO ()
    c_tiger_init
        hashInternalUpdate :: Ptr (Context Tiger) -> Ptr Word8 -> Word32 -> IO ()
    hashInternalUpdate        = Ptr (Context Tiger) -> Ptr Word8 -> Word32 -> IO ()
    forall a. Ptr (Context a) -> Ptr Word8 -> Word32 -> IO ()
    c_tiger_update
        hashInternalFinalize :: Ptr (Context Tiger) -> Ptr (Digest Tiger) -> IO ()
    hashInternalFinalize      = Ptr (Context Tiger) -> Ptr (Digest Tiger) -> IO ()
    forall a. Ptr (Context a) -> Ptr (Digest a) -> IO ()
    c_tiger_finalize

    foreign import ccall unsafe "cryptonite_tiger_init"
        c_tiger_init :: Ptr (Context a)-> IO ()

    foreign import ccall "cryptonite_tiger_update"
        c_tiger_update :: Ptr (Context a) -> Ptr Word8 -> Word32 -> IO ()

    foreign import ccall unsafe "cryptonite_tiger_finalize"
        c_tiger_finalize :: Ptr (Context a) -> Ptr (Digest a) -> IO ()