{-# LINE 1 "src/Crypto/Hash/BLAKE2/BLAKE2s.hsc" #-}
module Crypto.Hash.BLAKE2.BLAKE2s
(
BLAKE2sState,
initialize,
initialize',
update,
finalize,
hash
) where
import Data.ByteString (ByteString)
import Foreign.C.Types (CInt(..), CSize(..))
import Foreign.ForeignPtr (ForeignPtr)
import Foreign.Storable (Storable(..))
import Crypto.Hash.BLAKE2.Internal
data BLAKE2sStruct
instance Storable BLAKE2sStruct where
sizeOf :: BLAKE2sStruct -> Int
sizeOf BLAKE2sStruct
_ = (Int
136)
{-# LINE 32 "src/Crypto/Hash/BLAKE2/BLAKE2s.hsc" #-}
alignment _ = 8
{-# LINE 33 "src/Crypto/Hash/BLAKE2/BLAKE2s.hsc" #-}
peek = error "peek not implemented"
poke :: Ptr BLAKE2sStruct -> BLAKE2sStruct -> IO ()
poke = forall a. HasCallStack => [Char] -> a
error [Char]
"poke not implemented"
type BLAKE2sState = ForeignPtr BLAKE2sStruct
initialize :: Int
-> BLAKE2sState
initialize :: Int -> BLAKE2sState
initialize = forall a. Storable a => InitFunc a -> Int -> ForeignPtr a
initializer InitFunc BLAKE2sStruct
c_blake2s_init
{-# INLINE initialize #-}
initialize' :: Int
-> ByteString
-> BLAKE2sState
initialize' :: Int -> ByteString -> BLAKE2sState
initialize' = forall a.
Storable a =>
InitKeyFunc a -> Int -> ByteString -> ForeignPtr a
initializer' InitKeyFunc BLAKE2sStruct
c_blake2s_init_key
{-# INLINE initialize' #-}
update :: ByteString
-> BLAKE2sState
-> BLAKE2sState
update :: ByteString -> BLAKE2sState -> BLAKE2sState
update = forall a.
Storable a =>
UpdateFunc a -> ByteString -> ForeignPtr a -> ForeignPtr a
updater UpdateFunc BLAKE2sStruct
c_blake2s_update
{-# INLINE update #-}
finalize :: Int
-> BLAKE2sState
-> ByteString
finalize :: Int -> BLAKE2sState -> ByteString
finalize = forall a.
Storable a =>
FinalFunc a -> Int -> ForeignPtr a -> ByteString
finalizer UpdateFunc BLAKE2sStruct
c_blake2s_final
{-# INLINE finalize #-}
hash :: Int
-> ByteString
-> ByteString
-> ByteString
hash :: Int -> ByteString -> ByteString -> ByteString
hash = HashFunc -> Int -> ByteString -> ByteString -> ByteString
hasher HashFunc
c_blake2s
{-# INLINE hash #-}
foreign import ccall unsafe "blake2.h blake2s"
c_blake2s :: HashFunc
foreign import ccall unsafe "blake2.h blake2s_init"
c_blake2s_init :: InitFunc BLAKE2sStruct
foreign import ccall unsafe "blake2.h blake2s_init_key"
c_blake2s_init_key :: InitKeyFunc BLAKE2sStruct
foreign import ccall unsafe "blake2.h blake2s_update"
c_blake2s_update :: UpdateFunc BLAKE2sStruct
foreign import ccall unsafe "blake2.h blake2s_final"
c_blake2s_final :: FinalFunc BLAKE2sStruct