{-# LANGUAGE TypeApplications #-}
module Crypto.Hash.Utils
( blake2b256
, blake2b224
) where
import Prelude
import Crypto.Hash
( hash )
import Crypto.Hash.Algorithms
( Blake2b_224, Blake2b_256 )
import Data.ByteArray
( ByteArrayAccess )
import Data.ByteString
( ByteString )
import qualified Data.ByteArray as BA
blake2b256 :: ByteArrayAccess a => a -> ByteString
blake2b256 :: a -> ByteString
blake2b256 = Digest Blake2b_256 -> ByteString
forall bin bout.
(ByteArrayAccess bin, ByteArray bout) =>
bin -> bout
BA.convert (Digest Blake2b_256 -> ByteString)
-> (a -> Digest Blake2b_256) -> a -> ByteString
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (ByteArrayAccess a, HashAlgorithm Blake2b_256) =>
a -> Digest Blake2b_256
forall ba a.
(ByteArrayAccess ba, HashAlgorithm a) =>
ba -> Digest a
hash @_ @Blake2b_256
blake2b224 :: ByteArrayAccess a => a -> ByteString
blake2b224 :: a -> ByteString
blake2b224 = Digest Blake2b_224 -> ByteString
forall bin bout.
(ByteArrayAccess bin, ByteArray bout) =>
bin -> bout
BA.convert (Digest Blake2b_224 -> ByteString)
-> (a -> Digest Blake2b_224) -> a -> ByteString
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (ByteArrayAccess a, HashAlgorithm Blake2b_224) =>
a -> Digest Blake2b_224
forall ba a.
(ByteArrayAccess ba, HashAlgorithm a) =>
ba -> Digest a
hash @_ @Blake2b_224