Passphrase-related fixes
Move normalize code to one place on the wallet Passphrases don't have password strength meter
This commit is contained in:
@@ -1738,13 +1738,17 @@ class BIP44_Wallet(BIP32_HD_Wallet):
|
||||
acc_id, (change, address_index) = self.get_address_index(address)
|
||||
return self.address_derivation(acc_id, change, address_index)
|
||||
|
||||
@staticmethod
|
||||
def normalize_passphrase(passphrase):
|
||||
return normalize('NFKD', unicode(passphrase or ''))
|
||||
|
||||
@staticmethod
|
||||
def mnemonic_to_seed(mnemonic, passphrase):
|
||||
# See BIP39
|
||||
import pbkdf2, hashlib, hmac
|
||||
PBKDF2_ROUNDS = 2048
|
||||
mnemonic = normalize('NFKD', ' '.join(mnemonic.split()))
|
||||
passphrase = normalize('NFKD', passphrase)
|
||||
passphrase = BIP44_Wallet.normalize_passphrase(passphrase)
|
||||
return pbkdf2.PBKDF2(mnemonic, 'mnemonic' + passphrase,
|
||||
iterations = PBKDF2_ROUNDS, macmodule = hmac,
|
||||
digestmodule = hashlib.sha512).read(64)
|
||||
|
||||
Reference in New Issue
Block a user