Browse Source

Partially revert prior

283
Neil Booth 9 years ago
parent
commit
96c7f9e7cb
  1. 12
      plugins/keepkey/keepkey.py
  2. 12
      plugins/trezor/trezor.py

12
plugins/keepkey/keepkey.py

@ -93,9 +93,15 @@ class KeepKeyWallet(BIP32_HD_Wallet):
return pbkdf2.PBKDF2(mnemonic, 'mnemonic' + passphrase, iterations = PBKDF2_ROUNDS, macmodule = hmac, digestmodule = hashlib.sha512).read(64) return pbkdf2.PBKDF2(mnemonic, 'mnemonic' + passphrase, iterations = PBKDF2_ROUNDS, macmodule = hmac, digestmodule = hashlib.sha512).read(64)
def derive_xkeys(self, root, derivation, password): def derive_xkeys(self, root, derivation, password):
derivation = derivation.replace(self.root_name,"44'/0'/") x = self.master_private_keys.get(root)
xpub = self.get_public_key(derivation) if x:
return xpub, None root_xprv = pw_decode(x, password)
xprv, xpub = bip32_private_derivation(root_xprv, root, derivation)
return xpub, xprv
else:
derivation = derivation.replace(self.root_name,"44'/0'/")
xpub = self.get_public_key(derivation)
return xpub, None
def get_public_key(self, bip32_path): def get_public_key(self, bip32_path):
address_n = self.plugin.get_client().expand_path(bip32_path) address_n = self.plugin.get_client().expand_path(bip32_path)

12
plugins/trezor/trezor.py

@ -92,9 +92,15 @@ class TrezorWallet(BIP32_HD_Wallet):
return pbkdf2.PBKDF2(mnemonic, 'mnemonic' + passphrase, iterations = PBKDF2_ROUNDS, macmodule = hmac, digestmodule = hashlib.sha512).read(64) return pbkdf2.PBKDF2(mnemonic, 'mnemonic' + passphrase, iterations = PBKDF2_ROUNDS, macmodule = hmac, digestmodule = hashlib.sha512).read(64)
def derive_xkeys(self, root, derivation, password): def derive_xkeys(self, root, derivation, password):
derivation = derivation.replace(self.root_name,"44'/0'/") x = self.master_private_keys.get(root)
xpub = self.get_public_key(derivation) if x:
return xpub, None root_xprv = pw_decode(x, password)
xprv, xpub = bip32_private_derivation(root_xprv, root, derivation)
return xpub, xprv
else:
derivation = derivation.replace(self.root_name,"44'/0'/")
xpub = self.get_public_key(derivation)
return xpub, None
def get_public_key(self, bip32_path): def get_public_key(self, bip32_path):
address_n = self.plugin.get_client().expand_path(bip32_path) address_n = self.plugin.get_client().expand_path(bip32_path)

Loading…
Cancel
Save