summaryrefslogtreecommitdiff
path: root/passlib/crypto/scrypt
diff options
context:
space:
mode:
Diffstat (limited to 'passlib/crypto/scrypt')
-rw-r--r--passlib/crypto/scrypt/__init__.py5
-rw-r--r--passlib/crypto/scrypt/_builtin.py13
2 files changed, 8 insertions, 10 deletions
diff --git a/passlib/crypto/scrypt/__init__.py b/passlib/crypto/scrypt/__init__.py
index c71873a..cd10632 100644
--- a/passlib/crypto/scrypt/__init__.py
+++ b/passlib/crypto/scrypt/__init__.py
@@ -6,7 +6,6 @@ XXX: add this module to public docs?
#==========================================================================
# imports
#==========================================================================
-from __future__ import absolute_import
# core
import logging; log = logging.getLogger(__name__)
from warnings import warn
@@ -108,10 +107,10 @@ def scrypt(secret, salt, n, r, p=1, keylen=32):
"""run SCrypt key derivation function using specified parameters.
:arg secret:
- passphrase string (unicode is encoded to bytes using utf-8).
+ passphrase string (str is encoded to bytes using utf-8).
:arg salt:
- salt string (unicode is encoded to bytes using utf-8).
+ salt string (str is encoded to bytes using utf-8).
:arg n:
integer 'N' parameter
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