packages feed

crypton-2.3.1 / Crypto / Hash / SHA224.hs

{-# LANGUAGE DataKinds #-}{-# LANGUAGE DeriveDataTypeable #-}{-# LANGUAGE ForeignFunctionInterface #-}{-# LANGUAGE TypeFamilies #-}-- |-- Module      : Crypto.Hash.SHA224-- License     : BSD-style-- Maintainer  : Vincent Hanquez <vincent@snarc.org>-- Stability   : experimental-- Portability : unknown---- Module containing the binding functions to work with the-- SHA224 cryptographic hash.module Crypto.Hash.SHA224 (SHA224 (..)) whereimport Crypto.Hash.Typesimport Data.Dataimport Data.Word (Word32, Word8)import Foreign.Ptr (Ptr)-- | SHA224 cryptographic hash algorithmdata SHA224 = SHA224    deriving (Show, Data)instance HashAlgorithm SHA224 where    type HashBlockSize SHA224 = 64    type HashDigestSize SHA224 = 28    type HashInternalContextSize SHA224 = 192    hashBlockSize _ = 64    hashDigestSize _ = 28    hashInternalContextSize _ = 192    hashInternalInit = c_sha224_init    hashInternalUpdate = c_sha224_update    hashInternalFinalize = c_sha224_finalize    hashInternalRfc6979 _ = 1instance HashAlgorithmPrefix SHA224 where    hashInternalFinalizePrefix = c_sha224_finalize_prefixforeign import ccall unsafe "crypton_sha224_init"    c_sha224_init :: Ptr (Context a) -> IO ()c_sha224_update :: Ptr (Context a) -> Ptr Word8 -> Word32 -> IO ()c_sha224_update = updateBySize c_sha224_update_unsafe c_sha224_update_safeforeign import ccall unsafe "crypton_sha224_update"    c_sha224_update_unsafe :: Ptr (Context a) -> Ptr Word8 -> Word32 -> IO ()foreign import ccall "crypton_sha224_update"    c_sha224_update_safe :: Ptr (Context a) -> Ptr Word8 -> Word32 -> IO ()foreign import ccall unsafe "crypton_sha224_finalize"    c_sha224_finalize :: Ptr (Context a) -> Ptr (Digest a) -> IO ()foreign import ccall "crypton_sha224_finalize_prefix"    c_sha224_finalize_prefix        :: Ptr (Context a) -> Ptr Word8 -> Word32 -> Word32 -> Ptr (Digest a) -> IO ()