diff options
Diffstat (limited to 'rsa')
-rw-r--r-- | rsa/key.py | 12 | ||||
-rw-r--r-- | rsa/transform.py | 8 |
2 files changed, 10 insertions, 10 deletions
@@ -221,11 +221,11 @@ class PrivateKey(AbstractKey): >>> pk = PrivateKey(3727264081, 65537, 3349121513, 65063, 57287) >>> pk.exp1 - 55063L + 55063 >>> pk.exp2 - 10095L + 10095 >>> pk.coef - 50797L + 50797 If you give exp1, exp2 or coef, they will be used as-is: @@ -250,12 +250,12 @@ class PrivateKey(AbstractKey): # Calculate the other values if they aren't supplied if exp1 is None: - self.exp1 = long(d % (p - 1)) + self.exp1 = int(d % (p - 1)) else: self.exp1 = exp1 if exp1 is None: - self.exp2 = long(d % (q - 1)) + self.exp2 = int(d % (q - 1)) else: self.exp2 = exp2 @@ -409,7 +409,7 @@ def extended_gcd(a, b): oa = a #Remember original a/b to remove ob = b #negative values from return results while b != 0: - q = long(a // b) + q = a // b (a, b) = (b, a % b) (x, lx) = ((lx - (q * x)),x) (y, ly) = ((ly - (q * y)),y) diff --git a/rsa/transform.py b/rsa/transform.py index 0db546b..f2c9a65 100644 --- a/rsa/transform.py +++ b/rsa/transform.py @@ -32,11 +32,11 @@ def bytes2int(bytes): >>> (((128 * 256) + 64) * 256) + 15 8405007 >>> bytes2int('\x80@\x0f') - 8405007L + 8405007 """ - return long(binascii.hexlify(bytes), 16) + return int(binascii.hexlify(bytes), 16) def int2bytes(number, block_size=None): r'''Converts a number to a string of bytes. @@ -53,12 +53,12 @@ def int2bytes(number, block_size=None): >>> int2bytes(123456789) '\x07[\xcd\x15' >>> bytes2int(int2bytes(123456789)) - 123456789L + 123456789 >>> int2bytes(123456789, 6) '\x00\x00\x07[\xcd\x15' >>> bytes2int(int2bytes(123456789, 128)) - 123456789L + 123456789 >>> int2bytes(123456789, 3) Traceback (most recent call last): |