From 8a07c2654c7cd62b179ddff510857ea74ae6be3d Mon Sep 17 00:00:00 2001 From: SomberNight Date: Tue, 17 Oct 2017 06:44:37 +0200 Subject: [PATCH] fix: py3 in bitcoin.py: aes_encrypt_with_iv() and aes_decrypt_with_iv() --- lib/bitcoin.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/bitcoin.py b/lib/bitcoin.py index 946910da2..b0dc221a3 100644 --- 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: