mirror of
https://github.com/Legrandin/pycryptodome.git
synced 2025-10-19 07:53:49 +00:00
Update benchmark with BLAKE2b and BLAKE2s
This commit is contained in:
parent
d0311fb416
commit
a64aead56d
1 changed files with 15 additions and 2 deletions
|
@ -34,7 +34,7 @@ from Crypto.Cipher import (AES, ARC2, ARC4, Blowfish, CAST, DES3, DES,
|
|||
Salsa20)
|
||||
from Crypto.Hash import (HMAC, MD2, MD4, MD5, SHA224, SHA256, SHA384, SHA512,
|
||||
CMAC, SHA3_224, SHA3_256, SHA3_384, SHA3_512,
|
||||
BLAKE2b)
|
||||
BLAKE2b, BLAKE2s)
|
||||
from Crypto.Random import get_random_bytes
|
||||
import Crypto.Util.Counter
|
||||
from Crypto.Util.number import bytes_to_long
|
||||
|
@ -68,6 +68,18 @@ except AttributeError:
|
|||
from Crypto.Random import random as pycrypto_random
|
||||
import random as stdlib_random
|
||||
|
||||
class BLAKE2b_512(object):
|
||||
digest_size = 512
|
||||
@staticmethod
|
||||
def new(data=None):
|
||||
return BLAKE2b.new(digest_bits=512, data=data)
|
||||
|
||||
class BLAKE2s_256(object):
|
||||
digest_size = 256
|
||||
@staticmethod
|
||||
def new(data=None):
|
||||
return BLAKE2s.new(digest_bits=256, data=data)
|
||||
|
||||
class ModeNotAvailable(ValueError):
|
||||
pass
|
||||
|
||||
|
@ -379,7 +391,8 @@ class Benchmark:
|
|||
("SHA3_256", SHA3_256),
|
||||
("SHA3_384", SHA3_384),
|
||||
("SHA3_512", SHA3_512),
|
||||
("BLAKE2b", BLAKE2b),
|
||||
("BLAKE2b", BLAKE2b_512),
|
||||
("BLAKE2s", BLAKE2s_256),
|
||||
]
|
||||
if RIPEMD160 is not None:
|
||||
hash_specs += [("RIPEMD160", RIPEMD160)]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue