def xfp_from_xpub(xpub): # sometime we need to BIP32 fingerprint value: 4 bytes of ripemd(sha256(pubkey)) # UNTESTED kk = bfh(Xpub.get_pubkey_from_xpub(xpub, [])) assert len(kk) == 33 xfp, = unpack('<I', hash_160(kk)[0:4]) return xfp
def get_password_for_storage_encryption(self) -> str: # since ledger firware 1.6.1 we need to provide the full derivation path # see https://support.ledger.com/hc/en-us/articles/360015738179-Derivation-path-vulnerability-in-Bitcoin-derivati> derivation = ( "m/44'" "/" + str(constants.net.BIP44_COIN_TYPE) + "'" "/4541509'" # ascii 'ELE' as decimal ("BIP43 purpose") "/1112098098'") # ascii 'BIE2' as decimal # note: using a different password based on hw device type is highly undesirable! see #5993 xpub = self.get_xpub(derivation, "standard") password = Xpub.get_pubkey_from_xpub(xpub, ()).hex() return password
def get_password_for_storage_encryption(self) -> str: # note: using a different password based on hw device type is highly undesirable! see #5993 derivation = get_derivation_used_for_hw_device_encryption() xpub = self.get_xpub(derivation, "standard") password = Xpub.get_pubkey_from_xpub(xpub, ()).hex() return password