aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Manganiello <adamantike@users.noreply.github.com>2017-01-17 13:33:08 -0300
committerSybren A. Stüvel <sybren@stuvel.eu>2017-01-17 17:33:08 +0100
commit2d81e0fe4b89398876da8a9027d1465a5bb4434b (patch)
treed37949454e2a741e21de3993113b5f08c30e12f1
parentd3727172cedb409613739be6af197c3b03cc163d (diff)
downloadrsa-2d81e0fe4b89398876da8a9027d1465a5bb4434b.tar.gz
Use iterative zip in Python 2 (#85)
Good catch, thanks!
-rw-r--r--rsa/_compat.py3
-rw-r--r--rsa/common.py2
-rw-r--r--rsa/key.py2
3 files changed, 6 insertions, 1 deletions
diff --git a/rsa/_compat.py b/rsa/_compat.py
index 38bab08..71197a5 100644
--- a/rsa/_compat.py
+++ b/rsa/_compat.py
@@ -18,6 +18,7 @@
from __future__ import absolute_import
+import itertools
import sys
from struct import pack
@@ -42,9 +43,11 @@ else:
if PY2:
integer_types = (int, long)
range = xrange
+ zip = itertools.izip
else:
integer_types = (int, )
range = range
+ zip = zip
def write_to_stdout(data):
diff --git a/rsa/common.py b/rsa/common.py
index 4f8c0d9..7c8a082 100644
--- a/rsa/common.py
+++ b/rsa/common.py
@@ -14,6 +14,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
+from rsa._compat import zip
+
"""Common functionality shared by several modules."""
diff --git a/rsa/key.py b/rsa/key.py
index 8170916..196f78d 100644
--- a/rsa/key.py
+++ b/rsa/key.py
@@ -491,7 +491,7 @@ class PrivateKey(AbstractKey):
if priv[0] != 0:
raise ValueError('Unable to read this file, version %s != 0' % priv[0])
- as_ints = tuple(map(int, priv[1:6]))
+ as_ints = map(int, priv[1:6])
key = cls(*as_ints)
exp1, exp2, coef = map(int, priv[6:9])