    {-# LANGUAGE CPP                        #-}
    {-# LANGUAGE DataKinds                  #-}
    {-# LANGUAGE GeneralizedNewtypeDeriving #-}
    {-# LANGUAGE TypeFamilies               #-}
    {-# LANGUAGE FlexibleInstances          #-}

    {-# LANGUAGE MultiParamTypeClasses      #-}
    {-# CFILES raaz/hash/sha1/portable.c    #-}

    {-|

    This module exposes the `SHA1` hash constructor. You would hardly need
    to import the module directly as you would want to treat the `SHA1`
    type as an opaque type for type safety. This module is exported only
    for special uses like writing a test case or defining a binary
    instance etc.

    -}

    module Raaz.Hash.Sha1.Internal (SHA1(..)) where

    import           Data.String
    import           Data.Word
    import           Foreign.Storable    ( Storable(..) )

    import           Raaz.Core

    import           Raaz.Hash.Internal

    -- | The cryptographic hash SHA1.
    newtype SHA1 = SHA1 (Tuple 5 (BE Word32))
                 deriving (Ptr b -> Int -> IO SHA1
    Ptr b -> Int -> SHA1 -> IO ()
    Ptr SHA1 -> IO SHA1
    Ptr SHA1 -> Int -> IO SHA1
    Ptr SHA1 -> Int -> SHA1 -> IO ()
    Ptr SHA1 -> SHA1 -> IO ()
    SHA1 -> Int
    (SHA1 -> Int)
    -> (SHA1 -> Int)
    -> (Ptr SHA1 -> Int -> IO SHA1)
    -> (Ptr SHA1 -> Int -> SHA1 -> IO ())
    -> (forall b. Ptr b -> Int -> IO SHA1)
    -> (forall b. Ptr b -> Int -> SHA1 -> IO ())
    -> (Ptr SHA1 -> IO SHA1)
    -> (Ptr SHA1 -> SHA1 -> IO ())
    -> Storable SHA1
    forall b. Ptr b -> Int -> IO SHA1
    forall b. Ptr b -> Int -> SHA1 -> IO ()
    forall a.
    (a -> Int)
    -> (a -> Int)
    -> (Ptr a -> Int -> IO a)
    -> (Ptr a -> Int -> a -> IO ())
    -> (forall b. Ptr b -> Int -> IO a)
    -> (forall b. Ptr b -> Int -> a -> IO ())
    -> (Ptr a -> IO a)
    -> (Ptr a -> a -> IO ())
    -> Storable a
    poke :: Ptr SHA1 -> SHA1 -> IO ()
    $cpoke :: Ptr SHA1 -> SHA1 -> IO ()
    peek :: Ptr SHA1 -> IO SHA1
    $cpeek :: Ptr SHA1 -> IO SHA1
    pokeByteOff :: Ptr b -> Int -> SHA1 -> IO ()
    $cpokeByteOff :: forall b. Ptr b -> Int -> SHA1 -> IO ()
    peekByteOff :: Ptr b -> Int -> IO SHA1
    $cpeekByteOff :: forall b. Ptr b -> Int -> IO SHA1
    pokeElemOff :: Ptr SHA1 -> Int -> SHA1 -> IO ()
    $cpokeElemOff :: Ptr SHA1 -> Int -> SHA1 -> IO ()
    peekElemOff :: Ptr SHA1 -> Int -> IO SHA1
    $cpeekElemOff :: Ptr SHA1 -> Int -> IO SHA1
    alignment :: SHA1 -> Int
    $calignment :: SHA1 -> Int
    sizeOf :: SHA1 -> Int
    $csizeOf :: SHA1 -> Int
    Storable, Storable SHA1
    Ptr SHA1 -> IO SHA1
    Ptr SHA1 -> Int -> IO ()
    Ptr SHA1 -> SHA1 -> IO ()
    Storable SHA1 =>
    (Ptr SHA1 -> SHA1 -> IO ())
    -> (Ptr SHA1 -> IO SHA1)
    -> (Ptr SHA1 -> Int -> IO ())
    -> EndianStore SHA1
    forall w.
    Storable w =>
    (Ptr w -> w -> IO ())
    -> (Ptr w -> IO w) -> (Ptr w -> Int -> IO ()) -> EndianStore w
    adjustEndian :: Ptr SHA1 -> Int -> IO ()
    $cadjustEndian :: Ptr SHA1 -> Int -> IO ()
    load :: Ptr SHA1 -> IO SHA1
    $cload :: Ptr SHA1 -> IO SHA1
    store :: Ptr SHA1 -> SHA1 -> IO ()
    $cstore :: Ptr SHA1 -> SHA1 -> IO ()
    $cp1EndianStore :: Storable SHA1
    EndianStore, SHA1 -> SHA1 -> Result
    (SHA1 -> SHA1 -> Result) -> Equality SHA1
    forall a. (a -> a -> Result) -> Equality a
    eq :: SHA1 -> SHA1 -> Result
    $ceq :: SHA1 -> SHA1 -> Result
    Equality, SHA1 -> SHA1 -> Bool
    (SHA1 -> SHA1 -> Bool) -> (SHA1 -> SHA1 -> Bool) -> Eq SHA1
    forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
    /= :: SHA1 -> SHA1 -> Bool
    $c/= :: SHA1 -> SHA1 -> Bool
    == :: SHA1 -> SHA1 -> Bool
    $c== :: SHA1 -> SHA1 -> Bool
    Eq)

    instance Encodable SHA1

    instance IsString SHA1 where
      fromString :: String -> SHA1
    fromString = String -> SHA1
    forall a. Encodable a => String -> a
    fromBase16

    instance Show SHA1 where
      show :: SHA1 -> String
    show = SHA1 -> String
    forall a. Encodable a => a -> String
    showBase16

    instance Initialisable (HashMemory SHA1) () where
      initialise :: () -> MT (HashMemory SHA1) ()
    initialise _ = SHA1 -> MT (HashMemory SHA1) ()
    forall m v. Initialisable m v => v -> MT m ()
    initialise (SHA1 -> MT (HashMemory SHA1) ())
    -> SHA1 -> MT (HashMemory SHA1) ()
    forall a b. (a -> b) -> a -> b
    $ Tuple 5 (BE Word32) -> SHA1
    SHA1 (Tuple 5 (BE Word32) -> SHA1) -> Tuple 5 (BE Word32) -> SHA1
    forall a b. (a -> b) -> a -> b
    $ [BE Word32] -> Tuple 5 (BE Word32)
    forall a (dim :: Nat).
    (Unbox a, Dimension dim) =>
    [a] -> Tuple dim a
    unsafeFromList [ 0x67452301
                                                        , 0xefcdab89
                                                        , 0x98badcfe
                                                        , 0x10325476
                                                        , 0xc3d2e1f0
                                                        ]

    instance Primitive SHA1 where
      blockSize :: SHA1 -> BYTES Int
    blockSize _              = Int -> BYTES Int
    forall a. a -> BYTES a
    BYTES 64
      type Implementation SHA1 = SomeHashI SHA1

    instance Hash SHA1 where
      additionalPadBlocks :: SHA1 -> BLOCKS SHA1
    additionalPadBlocks _ = Int -> BLOCKS SHA1
    forall a. Enum a => Int -> a
    toEnum 1