diff --git a/Crypto/Hash/Blake2.hs b/Crypto/Hash/Blake2.hs index b957fa3..d86a0d5 100644 --- a/Crypto/Hash/Blake2.hs +++ b/Crypto/Hash/Blake2.hs @@ -60,7 +60,7 @@ import Crypto.Internal.Nat data Blake2s (bitlen :: Nat) = Blake2s deriving (Show, Typeable) -instance (IsDivisibleBy8 bitlen, KnownNat bitlen) +instance (IsDivisibleBy8 bitlen, KnownNat bitlen, IsAtLeast bitlen 8, IsAtMost bitlen 256) => HashAlgorithm (Blake2s bitlen) where hashBlockSize _ = 64 @@ -92,7 +92,7 @@ foreign import ccall unsafe "cryptonite_blake2s_finalize" data Blake2b (bitlen :: Nat) = Blake2b deriving (Show, Typeable) -instance (IsDivisibleBy8 bitlen, KnownNat bitlen) +instance (IsDivisibleBy8 bitlen, KnownNat bitlen, IsAtLeast bitlen 8, IsAtMost bitlen 512) => HashAlgorithm (Blake2b bitlen) where hashBlockSize _ = 128 @@ -112,7 +112,7 @@ foreign import ccall unsafe "cryptonite_blake2b_finalize" data Blake2sp (bitlen :: Nat) = Blake2sp deriving (Show, Typeable) -instance (IsDivisibleBy8 bitlen, KnownNat bitlen) +instance (IsDivisibleBy8 bitlen, KnownNat bitlen, IsAtLeast bitlen 8, IsAtMost bitlen 256) => HashAlgorithm (Blake2sp bitlen) where hashBlockSize _ = 64 @@ -132,7 +132,7 @@ foreign import ccall unsafe "cryptonite_blake2sp_finalize" data Blake2bp (bitlen :: Nat) = Blake2bp deriving (Show, Typeable) -instance (IsDivisibleBy8 bitlen, KnownNat bitlen) +instance (IsDivisibleBy8 bitlen, KnownNat bitlen, IsAtLeast bitlen 8, IsAtMost bitlen 512) => HashAlgorithm (Blake2bp bitlen) where hashBlockSize _ = 128