[BLAKE2] update context size on the haskell to the latest code

This commit is contained in:
Vincent Hanquez 2017-10-02 20:44:51 +01:00
parent ba39c9c18d
commit 74f1c1872b
4 changed files with 22 additions and 22 deletions

View File

@ -65,10 +65,10 @@ instance (IsDivisibleBy8 bitlen, KnownNat bitlen, IsAtLeast bitlen 8, IsAtMost b
where
type HashBlockSize (Blake2s bitlen) = 64
type HashDigestSize (Blake2s bitlen) = Div8 bitlen
type HashInternalContextSize (Blake2s bitlen) = 185
type HashInternalContextSize (Blake2s bitlen) = 136
hashBlockSize _ = 64
hashDigestSize _ = byteLen (Proxy :: Proxy bitlen)
hashInternalContextSize _ = 185
hashInternalContextSize _ = 136
hashInternalInit p = c_blake2s_init p (integralNatVal (Proxy :: Proxy bitlen))
hashInternalUpdate = c_blake2s_update
hashInternalFinalize p = c_blake2s_finalize p (integralNatVal (Proxy :: Proxy bitlen))
@ -100,10 +100,10 @@ instance (IsDivisibleBy8 bitlen, KnownNat bitlen, IsAtLeast bitlen 8, IsAtMost b
where
type HashBlockSize (Blake2b bitlen) = 128
type HashDigestSize (Blake2b bitlen) = Div8 bitlen
type HashInternalContextSize (Blake2b bitlen) = 361
type HashInternalContextSize (Blake2b bitlen) = 248
hashBlockSize _ = 128
hashDigestSize _ = byteLen (Proxy :: Proxy bitlen)
hashInternalContextSize _ = 361
hashInternalContextSize _ = 248
hashInternalInit p = c_blake2b_init p (integralNatVal (Proxy :: Proxy bitlen))
hashInternalUpdate = c_blake2b_update
hashInternalFinalize p = c_blake2b_finalize p (integralNatVal (Proxy :: Proxy bitlen))

View File

@ -30,10 +30,10 @@ data Blake2b_160 = Blake2b_160
instance HashAlgorithm Blake2b_160 where
type HashBlockSize Blake2b_160 = 128
type HashDigestSize Blake2b_160 = 20
type HashInternalContextSize Blake2b_160 = 361
type HashInternalContextSize Blake2b_160 = 248
hashBlockSize _ = 128
hashDigestSize _ = 20
hashInternalContextSize _ = 361
hashInternalContextSize _ = 248
hashInternalInit p = c_blake2b_init p 160
hashInternalUpdate = c_blake2b_update
hashInternalFinalize p = c_blake2b_finalize p 160
@ -45,10 +45,10 @@ data Blake2b_224 = Blake2b_224
instance HashAlgorithm Blake2b_224 where
type HashBlockSize Blake2b_224 = 128
type HashDigestSize Blake2b_224 = 28
type HashInternalContextSize Blake2b_224 = 361
type HashInternalContextSize Blake2b_224 = 248
hashBlockSize _ = 128
hashDigestSize _ = 28
hashInternalContextSize _ = 361
hashInternalContextSize _ = 248
hashInternalInit p = c_blake2b_init p 224
hashInternalUpdate = c_blake2b_update
hashInternalFinalize p = c_blake2b_finalize p 224
@ -60,10 +60,10 @@ data Blake2b_256 = Blake2b_256
instance HashAlgorithm Blake2b_256 where
type HashBlockSize Blake2b_256 = 128
type HashDigestSize Blake2b_256 = 32
type HashInternalContextSize Blake2b_256 = 361
type HashInternalContextSize Blake2b_256 = 248
hashBlockSize _ = 128
hashDigestSize _ = 32
hashInternalContextSize _ = 361
hashInternalContextSize _ = 248
hashInternalInit p = c_blake2b_init p 256
hashInternalUpdate = c_blake2b_update
hashInternalFinalize p = c_blake2b_finalize p 256
@ -75,10 +75,10 @@ data Blake2b_384 = Blake2b_384
instance HashAlgorithm Blake2b_384 where
type HashBlockSize Blake2b_384 = 128
type HashDigestSize Blake2b_384 = 48
type HashInternalContextSize Blake2b_384 = 361
type HashInternalContextSize Blake2b_384 = 248
hashBlockSize _ = 128
hashDigestSize _ = 48
hashInternalContextSize _ = 361
hashInternalContextSize _ = 248
hashInternalInit p = c_blake2b_init p 384
hashInternalUpdate = c_blake2b_update
hashInternalFinalize p = c_blake2b_finalize p 384
@ -90,10 +90,10 @@ data Blake2b_512 = Blake2b_512
instance HashAlgorithm Blake2b_512 where
type HashBlockSize Blake2b_512 = 128
type HashDigestSize Blake2b_512 = 64
type HashInternalContextSize Blake2b_512 = 361
type HashInternalContextSize Blake2b_512 = 248
hashBlockSize _ = 128
hashDigestSize _ = 64
hashInternalContextSize _ = 361
hashInternalContextSize _ = 248
hashInternalInit p = c_blake2b_init p 512
hashInternalUpdate = c_blake2b_update
hashInternalFinalize p = c_blake2b_finalize p 512

View File

@ -30,10 +30,10 @@ data Blake2s_160 = Blake2s_160
instance HashAlgorithm Blake2s_160 where
type HashBlockSize Blake2s_160 = 64
type HashDigestSize Blake2s_160 = 20
type HashInternalContextSize Blake2s_160 = 185
type HashInternalContextSize Blake2s_160 = 136
hashBlockSize _ = 64
hashDigestSize _ = 20
hashInternalContextSize _ = 185
hashInternalContextSize _ = 136
hashInternalInit p = c_blake2s_init p 160
hashInternalUpdate = c_blake2s_update
hashInternalFinalize p = c_blake2s_finalize p 160
@ -45,10 +45,10 @@ data Blake2s_224 = Blake2s_224
instance HashAlgorithm Blake2s_224 where
type HashBlockSize Blake2s_224 = 64
type HashDigestSize Blake2s_224 = 28
type HashInternalContextSize Blake2s_224 = 185
type HashInternalContextSize Blake2s_224 = 136
hashBlockSize _ = 64
hashDigestSize _ = 28
hashInternalContextSize _ = 185
hashInternalContextSize _ = 136
hashInternalInit p = c_blake2s_init p 224
hashInternalUpdate = c_blake2s_update
hashInternalFinalize p = c_blake2s_finalize p 224
@ -60,10 +60,10 @@ data Blake2s_256 = Blake2s_256
instance HashAlgorithm Blake2s_256 where
type HashBlockSize Blake2s_256 = 64
type HashDigestSize Blake2s_256 = 32
type HashInternalContextSize Blake2s_256 = 185
type HashInternalContextSize Blake2s_256 = 136
hashBlockSize _ = 64
hashDigestSize _ = 32
hashInternalContextSize _ = 185
hashInternalContextSize _ = 136
hashInternalInit p = c_blake2s_init p 256
hashInternalUpdate = c_blake2s_update
hashInternalFinalize p = c_blake2s_finalize p 256

View File

@ -58,9 +58,9 @@ data HashCustom =
hashModules =
-- module header hash ctx dg blk
[ GenHashModule "Blake2s" "blake2.h" "blake2s" 185 (HashMulti [] [(160, 64), (224,64), (256,64)])
[ GenHashModule "Blake2s" "blake2.h" "blake2s" 136 (HashMulti [] [(160, 64), (224,64), (256,64)])
, GenHashModule "Blake2sp" "blake2.h" "blake2sp" 2185 (HashMulti [] [(224,64), (256,64)])
, GenHashModule "Blake2b" "blake2.h" "blake2b" 361 (HashMulti [] [(160, 128), (224, 128), (256, 128), (384, 128), (512,128)])
, GenHashModule "Blake2b" "blake2.h" "blake2b" 248 (HashMulti [] [(160, 128), (224, 128), (256, 128), (384, 128), (512,128)])
, GenHashModule "Blake2bp" "blake2.h" "blake2sp" 2325 (HashMulti [] [(512,128)])
, GenHashModule "MD2" "md2.h" "md2" 96 (HashSimple 128 16)
, GenHashModule "MD4" "md4.h" "md4" 96 (HashSimple 128 64)