当前位置: 首页>>代码示例>>Python>>正文


Python ellipticcurve.INFINITY属性代码示例

本文整理汇总了Python中ecdsa.ellipticcurve.INFINITY属性的典型用法代码示例。如果您正苦于以下问题:Python ellipticcurve.INFINITY属性的具体用法?Python ellipticcurve.INFINITY怎么用?Python ellipticcurve.INFINITY使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在ecdsa.ellipticcurve的用法示例。


在下文中一共展示了ellipticcurve.INFINITY属性的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: from_parent

# 需要导入模块: from ecdsa import ellipticcurve [as 别名]
# 或者: from ecdsa.ellipticcurve import INFINITY [as 别名]
def from_parent(parent_key, i):
        if i & HARDENED_INDEX:
            raise ValueError("Can't generate a hardened child key from a parent public key.")

        child = hmac.new(parent_key.chain_code,
                         parent_key.compressed_key + i.to_bytes(length=4, byteorder='big'),
                         hashlib.sha512).digest()
        child_left, child_right = child[:32], child[32:]
        if int.from_bytes(child_left, 'big') >= ecdsa.generator_256.order():
            return None

        temp_pri_key = SigningKey.from_string(string=child_left, curve=curves.NIST256p)

        ki = temp_pri_key.verifying_key.pubkey.point + parent_key.key.pubkey.point
        if ki == ellipticcurve.INFINITY:
            return None

        return HDPublicKey(public_key=VerifyingKey.from_public_point(point=ki, curve=curves.NIST256p),
                           chain_code=child_right,
                           index=i,
                           depth=parent_key.depth + 1,
                           parent_fingerprint=parent_key.fingerprint) 
开发者ID:ontio,项目名称:ontology-python-sdk,代码行数:24,代码来源:hd_public_key.py

示例2: get_child

# 需要导入模块: from ecdsa import ellipticcurve [as 别名]
# 或者: from ecdsa.ellipticcurve import INFINITY [as 别名]
def get_child(self, index, hardened=False):
        left, right = self.get_hash(index, hardened)
        point = ((left * generator_secp256k1)
                 + VerifyingKey.from_string(self.key.uncompressed[1:], curve=SECP256k1).pubkey.point)
        if point == INFINITY:
            raise ValueError('Computed point equals INFINITY')
        return ExtendedPublicKey(PublicKey.from_point(point), right, self.depth+1, self.get_fingerprint(), index, False) 
开发者ID:chainside,项目名称:btcpy,代码行数:9,代码来源:hd.py

示例3: test_infinity_point

# 需要导入模块: from ecdsa import ellipticcurve [as 别名]
# 或者: from ecdsa.ellipticcurve import INFINITY [as 别名]
def test_infinity_point(self):
        w = Wallet.new_random_wallet()
        with patch('multimerchant.wallet.keys.PublicKey.to_point',
                   return_value=INFINITY):
            self.assertRaises(
                InfinityPointException,
                w.get_child,
                1) 
开发者ID:BlockIo,项目名称:multimerchant-python,代码行数:10,代码来源:test_bip32.py

示例4: test_infinity_point

# 需要导入模块: from ecdsa import ellipticcurve [as 别名]
# 或者: from ecdsa.ellipticcurve import INFINITY [as 别名]
def test_infinity_point(self):
        w = Wallet.new_random_wallet()
        with patch('bitmerchant.wallet.keys.PublicKey.to_point',
                   return_value=INFINITY):
            self.assertRaises(
                InfinityPointException,
                w.get_child,
                1) 
开发者ID:sbuss,项目名称:bitmerchant,代码行数:10,代码来源:test_bip32.py


注:本文中的ecdsa.ellipticcurve.INFINITY属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。