tests: simplify deterministic encryption test

This commit is contained in:
Benjamin Dauvergne 2020-10-01 16:23:17 +02:00
parent 6731cf0ccc
commit 7a94dc3af7
1 changed files with 3 additions and 15 deletions

View File

@ -58,22 +58,10 @@ def test_deterministic_encryption():
for hash_name in ['md5', 'sha1', 'sha256', 'sha384', 'sha512']:
for count in [1, 50]:
crypted1 = crypto.aes_base64url_deterministic_encrypt(key, raw, salt,
hash_name=hash_name, count=count)
crypted2 = crypto.aes_base64url_deterministic_encrypt(key, raw, salt,
hash_name=hash_name, count=count)
crypted1 = crypto.aes_base64url_deterministic_encrypt(key, raw, salt, hash_name=hash_name, count=count)
crypted2 = crypto.aes_base64url_deterministic_encrypt(key, raw, salt, hash_name=hash_name, count=count)
assert crypted1 == crypted2
t = time.time()
for i in range(100):
crypted1 = crypto.aes_base64url_deterministic_encrypt(key, raw, salt,
hash_name=hash_name,
count=count)
t = time.time()
for i in range(1000):
assert crypto.aes_base64url_deterministic_decrypt(key, crypted1, salt,
max_count=count) == raw
assert crypto.aes_base64url_deterministic_decrypt(key, crypted1, salt, max_count=count) == raw
def test_hmac_url():