本文整理汇总了Python中ecdsa.VerifyingKey.from_public_point方法的典型用法代码示例。如果您正苦于以下问题:Python VerifyingKey.from_public_point方法的具体用法?Python VerifyingKey.from_public_point怎么用?Python VerifyingKey.from_public_point使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ecdsa.VerifyingKey
的用法示例。
在下文中一共展示了VerifyingKey.from_public_point方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: from_parent
# 需要导入模块: from ecdsa import VerifyingKey [as 别名]
# 或者: from ecdsa.VerifyingKey import from_public_point [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)
示例2: from_point
# 需要导入模块: from ecdsa import VerifyingKey [as 别名]
# 或者: from ecdsa.VerifyingKey import from_public_point [as 别名]
def from_point(cls, point, network=BitcoinMainNet, **kwargs):
"""Create a PublicKey from a point on the SECP256k1 curve.
:param point: A point on the SECP256k1 curve.
:type point: SECP256k1.point
"""
verifying_key = VerifyingKey.from_public_point(point, curve=SECP256k1)
return cls.from_verifying_key(verifying_key, network=network, **kwargs)