only test some ciphers
This commit is contained in:
parent
4d5d6c7c85
commit
1459282ae6
1 changed files with 12 additions and 3 deletions
|
@ -165,11 +165,20 @@ def encrypt_all(password, method, op, data):
|
|||
return b''.join(result)
|
||||
|
||||
|
||||
CIPHERS_TO_TEST = [
|
||||
b'aes-128-cfb',
|
||||
b'aes-256-cfb',
|
||||
b'rc4-md5',
|
||||
b'salsa20',
|
||||
b'chacha20',
|
||||
b'table',
|
||||
]
|
||||
|
||||
|
||||
def test_encryptor():
|
||||
from os import urandom
|
||||
plain = urandom(10240)
|
||||
for method in method_supported.keys():
|
||||
logging.warn('testing %s' % method.decode('utf-8'))
|
||||
for method in CIPHERS_TO_TEST:
|
||||
encryptor = Encryptor(b'key', method)
|
||||
cipher = encryptor.encrypt(plain)
|
||||
decryptor = Encryptor(b'key', method)
|
||||
|
@ -180,7 +189,7 @@ def test_encryptor():
|
|||
def test_encrypt_all():
|
||||
from os import urandom
|
||||
plain = urandom(10240)
|
||||
for method in method_supported.keys():
|
||||
for method in CIPHERS_TO_TEST:
|
||||
cipher = encrypt_all(b'key', method, 1, plain)
|
||||
plain2 = encrypt_all(b'key', method, 0, cipher)
|
||||
assert plain == plain2
|
||||
|
|
Loading…
Reference in a new issue