commit 7847a75d59b335f7917435caf2d9cfc50d69620b
parent f1792d1b1309d8ed704beb811a514cc9ed39528e
Author: ThomasV <thomasv@electrum.org>
Date: Tue, 17 Oct 2017 10:11:41 +0200
Merge pull request #3052 from SomberNight/py3_aes_encrypt_with_iv
fix: py3 in bitcoin.py: aes_encrypt_with_iv() and aes_decrypt_with_iv()
Diffstat:
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/lib/bitcoin.py b/lib/bitcoin.py
@@ -117,7 +117,7 @@ def aes_encrypt_with_iv(key, iv, data):
padlen = 16 - (len(data) % 16)
if padlen == 0:
padlen = 16
- data += chr(padlen) * padlen
+ data += bytes([padlen]) * padlen
e = AES.new(key, AES.MODE_CBC, iv).encrypt(data)
return e
else:
@@ -131,9 +131,9 @@ def aes_decrypt_with_iv(key, iv, data):
if AES:
cipher = AES.new(key, AES.MODE_CBC, iv)
data = cipher.decrypt(data)
- padlen = ord(data[-1])
+ padlen = data[-1]
for i in data[-padlen:]:
- if ord(i) != padlen:
+ if i != padlen:
raise InvalidPassword()
return data[0:-padlen]
else: