commit e4dfd3129a5126c6936f69510b8e97e6b9a31410
parent 42bbce4cb309bfd8af2388219603053e5f6a0dd0
Author: ThomasV <thomasv@gitorious>
Date: Mon, 8 Sep 2014 00:54:52 +0200
iv should be different from password
Diffstat:
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/plugins/labels.py b/plugins/labels.py
@@ -39,12 +39,12 @@ class Plugin(BasePlugin):
return "0.2.1"
def encode(self, message):
- encrypted = electrum.bitcoin.aes_encrypt_with_iv(self.encode_password, self.encode_password, unicode(message))
+ encrypted = electrum.bitcoin.aes_encrypt_with_iv(self.encode_password, self.iv, unicode(message))
encoded_message = base64.b64encode(encrypted)
return encoded_message
def decode(self, message):
- decoded_message = electrum.bitcoin.aes_decrypt_with_iv(self.encode_password, self.encode_password, base64.b64decode(unicode(message)) )
+ decoded_message = electrum.bitcoin.aes_decrypt_with_iv(self.encode_password, self.iv, base64.b64decode(unicode(message)) )
return decoded_message
@@ -66,6 +66,7 @@ class Plugin(BasePlugin):
self.wallet = wallet
mpk = self.wallet.get_master_public_key()
self.encode_password = hashlib.sha1(mpk).digest().encode('hex')[:32]
+ self.iv = hashlib.sha256(self.encode_password).digest()[:16]
self.wallet_id = hashlib.sha256(mpk).digest().encode('hex')
addresses = []