electrum

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

commit 1e4cdab096210ac0b8ebef1547c6d850ccc00d26
parent cba9a2dc2c1c786a50b3254b74a501d84213fc72
Author: ThomasV <thomasv@electrum.org>
Date:   Fri,  2 Sep 2016 10:20:04 +0200

normalize passphrase

Diffstat:
Mgui/qt/installwizard.py | 1-
Mlib/bitcoin.py | 2+-
Mlib/mnemonic.py | 5+++--
3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/gui/qt/installwizard.py b/gui/qt/installwizard.py @@ -7,7 +7,6 @@ import PyQt4.QtCore as QtCore import electrum from electrum.wallet import Wallet -from electrum.mnemonic import prepare_seed from electrum.util import UserCancelled from electrum.base_wizard import BaseWizard from electrum.i18n import _ diff --git a/lib/bitcoin.py b/lib/bitcoin.py @@ -160,7 +160,7 @@ hmac_sha_512 = lambda x,y: hmac.new(x, y, hashlib.sha512).digest() def is_new_seed(x, prefix=version.SEED_PREFIX): import mnemonic - x = mnemonic.prepare_seed(x) + x = mnemonic.normalize_text(x) s = hmac_sha_512("Seed version", x.encode('utf8')).encode('hex') return s.startswith(prefix) diff --git a/lib/mnemonic.py b/lib/mnemonic.py @@ -78,7 +78,7 @@ def is_CJK(c): return False -def prepare_seed(seed): +def normalize_text(seed): # normalize seed = unicodedata.normalize('NFKD', unicode(seed)) # lower @@ -126,7 +126,8 @@ class Mnemonic(object): @classmethod def mnemonic_to_seed(self, mnemonic, passphrase): PBKDF2_ROUNDS = 2048 - mnemonic = prepare_seed(mnemonic) + mnemonic = normalize_text(mnemonic) + passphrase = normalize_text(passphrase) return pbkdf2.PBKDF2(mnemonic, 'electrum' + passphrase, iterations = PBKDF2_ROUNDS, macmodule = hmac, digestmodule = hashlib.sha512).read(64) def mnemonic_encode(self, i):