{-# OPTIONS_HADDOCK prune #-}
module Crypto.Hash.SHA512 (
hash
, Lazy.hash_lazy
, MAC(..)
, hmac
, Lazy.hmac_lazy
, _hmac_rr
, _hmac_rsb
) where
import qualified Data.ByteString as BS
import Data.Word (Word8, Word64)
import Foreign.Ptr (Ptr)
import qualified Crypto.Hash.SHA512.Native as Native
import Crypto.Hash.SHA512.Internal (MAC(..), Registers)
import qualified Crypto.Hash.SHA512.Lazy as Lazy
import qualified Crypto.Hash.SHA512.Pure as Pure
hash :: BS.ByteString -> BS.ByteString
hash :: ByteString -> ByteString
hash ByteString
m
| Bool
Native.sha512_native_available = ByteString -> ByteString
Native.hash ByteString
m
| Bool
otherwise = ByteString -> ByteString
Pure.hash ByteString
m
{-# INLINABLE hash #-}
hmac :: BS.ByteString -> BS.ByteString -> MAC
hmac :: ByteString -> ByteString -> MAC
hmac ByteString
k ByteString
m
| Bool
Native.sha512_native_available = ByteString -> MAC
MAC (ByteString -> ByteString -> ByteString
Native.hmac ByteString
k ByteString
m)
| Bool
otherwise = ByteString -> MAC
MAC (ByteString -> ByteString -> ByteString
Pure.hmac ByteString
k ByteString
m)
{-# INLINABLE hmac #-}
_hmac_rr
:: Ptr Word64
-> Ptr Word64
-> Registers
-> Registers
-> IO ()
_hmac_rr :: Ptr Word64 -> Ptr Word64 -> Registers -> Registers -> IO ()
_hmac_rr Ptr Word64
rp Ptr Word64
bp Registers
k Registers
m
| Bool
Native.sha512_native_available = Ptr Word64 -> Ptr Word64 -> Registers -> Registers -> IO ()
Native._hmac_rr Ptr Word64
rp Ptr Word64
bp Registers
k Registers
m
| Bool
otherwise = Ptr Word64 -> Ptr Word64 -> Registers -> Registers -> IO ()
Pure._hmac_rr Ptr Word64
rp Ptr Word64
bp Registers
k Registers
m
{-# INLINABLE _hmac_rr #-}
_hmac_rsb
:: Ptr Word64
-> Ptr Word64
-> Registers
-> Registers
-> Word8
-> BS.ByteString
-> IO ()
_hmac_rsb :: Ptr Word64
-> Ptr Word64
-> Registers
-> Registers
-> Word8
-> ByteString
-> IO ()
_hmac_rsb Ptr Word64
rp Ptr Word64
bp Registers
k Registers
v Word8
sep ByteString
dat
| Bool
Native.sha512_native_available = Ptr Word64
-> Ptr Word64
-> Registers
-> Registers
-> Word8
-> ByteString
-> IO ()
Native._hmac_rsb Ptr Word64
rp Ptr Word64
bp Registers
k Registers
v Word8
sep ByteString
dat
| Bool
otherwise = Ptr Word64
-> Ptr Word64
-> Registers
-> Registers
-> Word8
-> ByteString
-> IO ()
Pure._hmac_rsb Ptr Word64
rp Ptr Word64
bp Registers
k Registers
v Word8
sep ByteString
dat
{-# INLINABLE _hmac_rsb #-}