diff options
author | Eli Collins <elic@assurancetechnologies.com> | 2020-10-06 14:33:37 -0400 |
---|---|---|
committer | Eli Collins <elic@assurancetechnologies.com> | 2020-10-06 14:33:37 -0400 |
commit | f76c2f1a6e58e8bb913b0c21d8030455aebf89df (patch) | |
tree | 2fbce572740089882dadb67efe4699d7b7909c58 | |
parent | 5a81787dc3b19f5286c846d272016d2bafd8cf5f (diff) | |
download | passlib-f76c2f1a6e58e8bb913b0c21d8030455aebf89df.tar.gz |
cleanup old python compat -- removed izip() wrapper
-rw-r--r-- | passlib/crypto/scrypt/_builtin.py | 13 | ||||
-rw-r--r-- | passlib/utils/__init__.py | 1 | ||||
-rw-r--r-- | passlib/utils/compat/__init__.py | 7 |
3 files changed, 6 insertions, 15 deletions
diff --git a/passlib/crypto/scrypt/_builtin.py b/passlib/crypto/scrypt/_builtin.py index e9bb305..c93e7a3 100644 --- a/passlib/crypto/scrypt/_builtin.py +++ b/passlib/crypto/scrypt/_builtin.py @@ -6,7 +6,6 @@ import operator import struct # pkg -from passlib.utils.compat import izip from passlib.crypto.digest import pbkdf2_hmac from passlib.crypto.scrypt._salsa import salsa20 # local @@ -170,7 +169,7 @@ class ScryptEngine(object): i = 0 while i < n: j = integerify(buffer) & n_mask - result = tuple(a ^ b for a, b in izip(buffer, get_v_elem(j))) + result = tuple(a ^ b for a, b in zip(buffer, get_v_elem(j))) bmix(result, buffer) i += 1 @@ -179,7 +178,7 @@ class ScryptEngine(object): # if not n_is_log_2: # while i < n: # j = integerify(buffer) % n - # tmp = tuple(a^b for a,b in izip(buffer, get_v_elem(j))) + # tmp = tuple(a^b for a,b in zip(buffer, get_v_elem(j))) # bmix(tmp,buffer) # i += 1 @@ -225,15 +224,15 @@ class ScryptEngine(object): j = 0 while j < half: jn = j+16 - target[j:jn] = tmp = salsa20(a ^ b for a, b in izip(tmp, siter)) - target[half+j:half+jn] = tmp = salsa20(a ^ b for a, b in izip(tmp, siter)) + target[j:jn] = tmp = salsa20(a ^ b for a, b in zip(tmp, siter)) + target[half+j:half+jn] = tmp = salsa20(a ^ b for a, b in zip(tmp, siter)) j = jn def _bmix_1(self, source, target): """special bmix() method optimized for ``r=1`` case""" B = source[16:] - target[:16] = tmp = salsa20(a ^ b for a, b in izip(B, iter(source))) - target[16:] = salsa20(a ^ b for a, b in izip(tmp, B)) + target[:16] = tmp = salsa20(a ^ b for a, b in zip(B, iter(source))) + target[16:] = salsa20(a ^ b for a, b in zip(tmp, B)) #================================================================= # eoc diff --git a/passlib/utils/__init__.py b/passlib/utils/__init__.py index 2bab92b..df4daf0 100644 --- a/passlib/utils/__init__.py +++ b/passlib/utils/__init__.py @@ -351,7 +351,6 @@ def consteq(left, right): result = 1 # run constant-time string comparision - # TODO: use izip instead (but first verify it's faster than zip for this case) if is_bytes: for l,r in zip(tmp, right): result |= l ^ r diff --git a/passlib/utils/compat/__init__.py b/passlib/utils/compat/__init__.py index eb45624..6bb4fee 100644 --- a/passlib/utils/compat/__init__.py +++ b/passlib/utils/compat/__init__.py @@ -167,13 +167,6 @@ int_types = (int,) num_types = (int, float) #============================================================================= -# iteration helpers -#============================================================================= -if True: # legacy PY3 indent - - izip = zip - -#============================================================================= # typing #============================================================================= ##def is_mapping(obj): |