Browse Source

lint code

auth
clowwindy 10 years ago
parent
commit
c553e7a725
  1. 9
      shadowsocks/crypto/salsa20_ctr.py

9
shadowsocks/crypto/salsa20_ctr.py

@ -28,6 +28,9 @@ import sys
slow_xor = False slow_xor = False
imported = False imported = False
salsa20 = None
numpy = None
BLOCK_SIZE = 16384 BLOCK_SIZE = 16384
@ -36,13 +39,13 @@ def run_imports():
if not imported: if not imported:
imported = True imported = True
try: try:
import numpy __import__('numpy')
except ImportError: except ImportError:
logging.error('can not import numpy, using SLOW XOR') logging.error('can not import numpy, using SLOW XOR')
logging.error('please install numpy if you use salsa20') logging.error('please install numpy if you use salsa20')
slow_xor = True slow_xor = True
try: try:
import salsa20 __import__('salsa20')
except ImportError: except ImportError:
logging.error('you have to install salsa20 before you use salsa20') logging.error('you have to install salsa20 before you use salsa20')
sys.exit(1) sys.exit(1)
@ -123,7 +126,7 @@ def test():
rounds = 1 * 1024 rounds = 1 * 1024
plain = urandom(BLOCK_SIZE * rounds) plain = urandom(BLOCK_SIZE * rounds)
import M2Crypto.EVP # import M2Crypto.EVP
# cipher = M2Crypto.EVP.Cipher('aes_128_cfb', 'k' * 32, 'i' * 16, 1, # cipher = M2Crypto.EVP.Cipher('aes_128_cfb', 'k' * 32, 'i' * 16, 1,
# key_as_bytes=0, d='md5', salt=None, i=1, # key_as_bytes=0, d='md5', salt=None, i=1,
# padding=1) # padding=1)

Loading…
Cancel
Save