check for at least one byte and at most 256 or 512 (blake2s or blake2b)
This commit is contained in:
parent
f0286281fb
commit
8b6bd1ed5e
@ -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
|
||||
|
||||
Loading…
Reference in New Issue
Block a user