module Tezos.Crypto.Hash
( blake2b
, blake2b160
, sha256
, sha512
) where
import Crypto.Hash (Blake2b_160, Blake2b_256, Digest, SHA256, SHA512, hash)
import qualified Data.ByteArray as ByteArray
blake2b :: ByteString -> ByteString
blake2b = fromDigest @Blake2b_256 . hash
blake2b160 :: ByteString -> ByteString
blake2b160 = fromDigest @Blake2b_160 . hash
sha256 :: ByteString -> ByteString
sha256 = fromDigest @SHA256 . hash
sha512 :: ByteString -> ByteString
sha512 = fromDigest @SHA512 . hash
fromDigest :: forall a. Digest a -> ByteString
fromDigest = ByteArray.convert