From 1459282ae643820e433767adc91ef72e3c2b72dd Mon Sep 17 00:00:00 2001 From: clowwindy Date: Thu, 11 Dec 2014 18:02:57 +0800 Subject: [PATCH] only test some ciphers --- shadowsocks/encrypt.py | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/shadowsocks/encrypt.py b/shadowsocks/encrypt.py index 7c5329f..e08c0a2 100644 --- a/shadowsocks/encrypt.py +++ b/shadowsocks/encrypt.py @@ -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