tMerge pull request #3052 from SomberNight/py3_aes_encrypt_with_iv - electrum - Electrum Bitcoin wallet HTML git clone https://git.parazyd.org/electrum DIR Log DIR Files DIR Refs DIR Submodules --- DIR commit 7847a75d59b335f7917435caf2d9cfc50d69620b DIR parent f1792d1b1309d8ed704beb811a514cc9ed39528e HTML 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: M lib/bitcoin.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) --- DIR diff --git a/lib/bitcoin.py b/lib/bitcoin.py t@@ -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: t@@ -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: