bip32.py 文件源码

python
阅读 21 收藏 0 点赞 0 评论 0

项目:electrumx 作者: kyuupichan 项目源码 文件源码
def child(self, n):
        '''Return the derived child extended pubkey at index N.'''
        if not 0 <= n < (1 << 31):
            raise ValueError('invalid BIP32 public key child number')

        msg = self.pubkey_bytes + struct.pack('>I', n)
        L, R = self._hmac_sha512(msg)

        curve = self.CURVE
        L = bytes_to_int(L)
        if L >= curve.order:
            raise DerivationError

        point = curve.generator * L + self.ec_point()
        if point == EC.INFINITY:
            raise DerivationError

        verkey = ecdsa.VerifyingKey.from_public_point(point, curve=curve)

        return PubKey(verkey, R, n, self.depth + 1, self)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号