1-- | 2-- Module : Crypto.Hash.SHA384 3-- License : BSD-style 4-- Maintainer : Vincent Hanquez <vincent@snarc.org> 5-- Stability : experimental 6-- Portability : unknown 7-- 8-- Module containing the binding functions to work with the 9-- SHA384 cryptographic hash. 10-- 11{-# LANGUAGE ForeignFunctionInterface #-} 12{-# LANGUAGE DeriveDataTypeable #-} 13{-# LANGUAGE DataKinds #-} 14{-# LANGUAGE TypeFamilies #-} 15module Crypto.Hash.SHA384 ( SHA384 (..) ) where 16 17import Crypto.Hash.Types 18import Foreign.Ptr (Ptr) 19import Data.Data 20import Data.Word (Word8, Word32) 21 22-- | SHA384 cryptographic hash algorithm 23data SHA384 = SHA384 24 deriving (Show,Data) 25 26instance HashAlgorithm SHA384 where 27 type HashBlockSize SHA384 = 128 28 type HashDigestSize SHA384 = 48 29 type HashInternalContextSize SHA384 = 256 30 hashBlockSize _ = 128 31 hashDigestSize _ = 48 32 hashInternalContextSize _ = 256 33 hashInternalInit = c_sha384_init 34 hashInternalUpdate = c_sha384_update 35 hashInternalFinalize = c_sha384_finalize 36 37instance HashAlgorithmPrefix SHA384 where 38 hashInternalFinalizePrefix = c_sha384_finalize_prefix 39 40foreign import ccall unsafe "cryptonite_sha384_init" 41 c_sha384_init :: Ptr (Context a)-> IO () 42 43foreign import ccall "cryptonite_sha384_update" 44 c_sha384_update :: Ptr (Context a) -> Ptr Word8 -> Word32 -> IO () 45 46foreign import ccall unsafe "cryptonite_sha384_finalize" 47 c_sha384_finalize :: Ptr (Context a) -> Ptr (Digest a) -> IO () 48 49foreign import ccall "cryptonite_sha384_finalize_prefix" 50 c_sha384_finalize_prefix :: Ptr (Context a) -> Ptr Word8 -> Word32 -> Word32 -> Ptr (Digest a) -> IO () 51