{-# LANGUAGE DataKinds #-}{-# LANGUAGE DeriveDataTypeable #-}{-# LANGUAGE ForeignFunctionInterface #-}{-# LANGUAGE TypeFamilies #-}-- |-- Module : Crypto.Hash.SHA384-- License : BSD-style-- Maintainer : Vincent Hanquez <vincent@snarc.org>-- Stability : experimental-- Portability : unknown---- Module containing the binding functions to work with the-- SHA384 cryptographic hash.module Crypto.Hash.SHA384 (SHA384 (..)) whereimport Crypto.Hash.Typesimport Data.Dataimport Data.Word (Word32, Word8)import Foreign.Ptr (Ptr)-- | SHA384 cryptographic hash algorithmdata SHA384 = SHA384 deriving (Show, Data)instance HashAlgorithm SHA384 where type HashBlockSize SHA384 = 128 type HashDigestSize SHA384 = 48 type HashInternalContextSize SHA384 = 256 hashBlockSize _ = 128 hashDigestSize _ = 48 hashInternalContextSize _ = 256 hashInternalInit = c_sha384_init hashInternalUpdate = c_sha384_update hashInternalFinalize = c_sha384_finalize hashInternalRfc6979 _ = 3instance HashAlgorithmPrefix SHA384 where hashInternalFinalizePrefix = c_sha384_finalize_prefixforeign import ccall unsafe "crypton_sha384_init" c_sha384_init :: Ptr (Context a) -> IO ()c_sha384_update :: Ptr (Context a) -> Ptr Word8 -> Word32 -> IO ()c_sha384_update = updateBySize c_sha384_update_unsafe c_sha384_update_safeforeign import ccall unsafe "crypton_sha384_update" c_sha384_update_unsafe :: Ptr (Context a) -> Ptr Word8 -> Word32 -> IO ()foreign import ccall "crypton_sha384_update" c_sha384_update_safe :: Ptr (Context a) -> Ptr Word8 -> Word32 -> IO ()foreign import ccall unsafe "crypton_sha384_finalize" c_sha384_finalize :: Ptr (Context a) -> Ptr (Digest a) -> IO ()foreign import ccall "crypton_sha384_finalize_prefix" c_sha384_finalize_prefix :: Ptr (Context a) -> Ptr Word8 -> Word32 -> Word32 -> Ptr (Digest a) -> IO ()