{-# LANGUAGE DataKinds #-}
{-# LANGUAGE PackageImports #-}
{-# LANGUAGE TypeFamilies #-}

-- | Implementation of the SHA512 hashing algorithm.
module Cardano.Crypto.Hash.SHA512 (
  SHA512,
)
where

import Cardano.Crypto.Hash.Class
import qualified Data.ByteArray as BA
import qualified "crypton" Crypto.Hash as H

data SHA512

instance HashAlgorithm SHA512 where
  type SizeHash SHA512 = 64
  hashAlgorithmName :: forall (proxy :: * -> *). proxy SHA512 -> String
hashAlgorithmName proxy SHA512
_ = String
"sha512"
  digest :: forall (proxy :: * -> *). proxy SHA512 -> ByteString -> ByteString
digest proxy SHA512
_ = Digest SHA512 -> ByteString
convert forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall ba a.
(ByteArrayAccess ba, HashAlgorithm a) =>
ba -> Digest a
H.hash

convert :: H.Digest H.SHA512 -> ByteString
convert :: Digest SHA512 -> ByteString
convert = forall bin bout.
(ByteArrayAccess bin, ByteArray bout) =>
bin -> bout
BA.convert