|
@ -1738,13 +1738,17 @@ class BIP44_Wallet(BIP32_HD_Wallet): |
|
|
acc_id, (change, address_index) = self.get_address_index(address) |
|
|
acc_id, (change, address_index) = self.get_address_index(address) |
|
|
return self.address_derivation(acc_id, change, address_index) |
|
|
return self.address_derivation(acc_id, change, address_index) |
|
|
|
|
|
|
|
|
|
|
|
@staticmethod |
|
|
|
|
|
def normalize_passphrase(passphrase): |
|
|
|
|
|
return normalize('NFKD', unicode(passphrase or '')) |
|
|
|
|
|
|
|
|
@staticmethod |
|
|
@staticmethod |
|
|
def mnemonic_to_seed(mnemonic, passphrase): |
|
|
def mnemonic_to_seed(mnemonic, passphrase): |
|
|
# See BIP39 |
|
|
# See BIP39 |
|
|
import pbkdf2, hashlib, hmac |
|
|
import pbkdf2, hashlib, hmac |
|
|
PBKDF2_ROUNDS = 2048 |
|
|
PBKDF2_ROUNDS = 2048 |
|
|
mnemonic = normalize('NFKD', ' '.join(mnemonic.split())) |
|
|
mnemonic = normalize('NFKD', ' '.join(mnemonic.split())) |
|
|
passphrase = normalize('NFKD', passphrase) |
|
|
passphrase = BIP44_Wallet.normalize_passphrase(passphrase) |
|
|
return pbkdf2.PBKDF2(mnemonic, 'mnemonic' + passphrase, |
|
|
return pbkdf2.PBKDF2(mnemonic, 'mnemonic' + passphrase, |
|
|
iterations = PBKDF2_ROUNDS, macmodule = hmac, |
|
|
iterations = PBKDF2_ROUNDS, macmodule = hmac, |
|
|
digestmodule = hashlib.sha512).read(64) |
|
|
digestmodule = hashlib.sha512).read(64) |
|
|