electrum

Electrum Bitcoin wallet
git clone https://git.parazyd.org/electrum
Log | Files | Refs | Submodules

commit 2c6534c1baed7e7999c424fc20f673aeec6130fe
parent 4b9b5327381d84482133266cf89d953b404635c7
Author: thomasv <thomasv@gitorious>
Date:   Sun, 15 Sep 2013 17:33:27 +0200

sign unicode messages

Diffstat:
Mgui/gui_classic/main_window.py | 4++--
Mlib/bitcoin.py | 3+++
2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/gui/gui_classic/main_window.py b/gui/gui_classic/main_window.py @@ -1496,7 +1496,7 @@ class ElectrumWindow(QMainWindow): @protected def do_sign(self, address, message, signature, password): try: - sig = self.wallet.sign_message(str(address.text()), str(message.toPlainText()), password) + sig = self.wallet.sign_message(str(address.text()), unicode(message.toPlainText()), password) signature.setText(sig) except BaseException, e: self.show_message(str(e)) @@ -1558,7 +1558,7 @@ class ElectrumWindow(QMainWindow): layout.setRowStretch(3,1) def do_verify(): - if self.wallet.verify_message(verify_address.text(), str(verify_signature.toPlainText()), str(verify_message.toPlainText())): + if self.wallet.verify_message(verify_address.text(), str(verify_signature.toPlainText()), unicode(verify_message.toPlainText())): self.show_message(_("Signature verified")) else: self.show_message(_("Error: wrong signature")) diff --git a/lib/bitcoin.py b/lib/bitcoin.py @@ -1,3 +1,4 @@ +# -*- coding: utf-8 -*- #!/usr/bin/env python # # Electrum - lightweight Bitcoin client @@ -286,6 +287,8 @@ SECP256k1 = ecdsa.curves.Curve("SECP256k1", curve_secp256k1, generator_secp256k1 from ecdsa.util import string_to_number, number_to_string def msg_magic(message): + message = message.encode('utf-8') + print_error(("message", message)) varint = var_int(len(message)) encoded_varint = "".join([chr(int(varint[i:i+2], 16)) for i in xrange(0, len(varint), 2)])