From 108d7d39f098a04afc177b5862ecd52e2d824d67 Mon Sep 17 00:00:00 2001 From: ThomasV Date: Wed, 9 Aug 2017 11:09:56 +0200 Subject: [PATCH] python3: fix password decode --- lib/bitcoin.py | 2 +- lib/keystore.py | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/lib/bitcoin.py b/lib/bitcoin.py index fa88cf635..b5b46eab7 100644 --- a/lib/bitcoin.py +++ b/lib/bitcoin.py @@ -150,7 +150,7 @@ def DecodeAES(secret, e): def pw_encode(s, password): if password: secret = Hash(password) - return EncodeAES(secret, to_bytes(s, "utf8")) + return EncodeAES(secret, to_bytes(s, "utf8")).decode('utf8') else: return s diff --git a/lib/keystore.py b/lib/keystore.py index fb1412f62..7897af135 100644 --- a/lib/keystore.py +++ b/lib/keystore.py @@ -149,7 +149,7 @@ class Imported_KeyStore(Software_KeyStore): except Exception: raise BaseException('Invalid private key') # allow overwrite - self.keypairs[pubkey] = pw_encode(sec, password).decode('ascii') + self.keypairs[pubkey] = pw_encode(sec, password) return pubkey def delete_imported_key(self, key): @@ -179,7 +179,7 @@ class Imported_KeyStore(Software_KeyStore): new_password = None for k, v in self.keypairs.items(): b = pw_decode(v, old_password) - c = pw_encode(b, new_password).decode('ascii') + c = pw_encode(b, new_password) self.keypairs[k] = c @@ -309,13 +309,13 @@ class BIP32_KeyStore(Deterministic_KeyStore, Xpub): new_password = None if self.has_seed(): decoded = self.get_seed(old_password) - self.seed = pw_encode(decoded, new_password).decode('ascii') + self.seed = pw_encode(decoded, new_password) if self.passphrase: decoded = self.get_passphrase(old_password) - self.passphrase = pw_encode(decoded, new_password).decode('ascii') + self.passphrase = pw_encode(decoded, new_password) if self.xprv is not None: b = pw_decode(self.xprv, old_password) - self.xprv = pw_encode(b, new_password).decode('ascii') + self.xprv = pw_encode(b, new_password) def is_watching_only(self): return self.xprv is None @@ -478,7 +478,7 @@ class Old_KeyStore(Deterministic_KeyStore): new_password = None if self.has_seed(): decoded = self.get_hex_seed(old_password) - self.seed = pw_encode(decoded, new_password).decode('ascii') + self.seed = pw_encode(decoded, new_password) class Hardware_KeyStore(KeyStore, Xpub):