Browse Source

do not expose mnemonic_to_seed

283
ThomasV 11 years ago
parent
commit
bf3f67c043
  1. 4
      lib/bitcoin.py
  2. 3
      lib/wallet.py

4
lib/bitcoin.py

@ -706,10 +706,10 @@ def xpub_from_xprv(xprv, testnet=False):
return EncodeBase58Check(xpub)
def bip32_root(seed, testnet=False):
def bip32_root(mnemonic_seed, testnet=False):
import hmac
header_pub, header_priv = _get_headers(testnet)
seed = seed.decode('hex')
seed = mnemonic_to_seed(mnemonic_seed,'')
I = hmac.new("Bitcoin seed", seed, hashlib.sha512).digest()
master_k = I[0:32]
master_c = I[32:]

3
lib/wallet.py

@ -1313,7 +1313,8 @@ class NewWallet(Deterministic_Wallet):
return xpub
def create_master_keys(self, password):
xpriv, xpub = bip32_root(mnemonic_to_seed(self.get_seed(password),'').encode('hex'))
seed = self.get_seed(password)
xpriv, xpub = bip32_root(seed)
self.add_master_public_key("m/", xpub)
self.add_master_private_key("m/", xpriv, password)

Loading…
Cancel
Save