當前位置: 首頁>>代碼示例>>Python>>正文


Python VerifyingKey.from_public_point方法代碼示例

本文整理匯總了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) 
開發者ID:ontio,項目名稱:ontology-python-sdk,代碼行數:24,代碼來源:hd_public_key.py

示例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) 
開發者ID:BlockIo,項目名稱:multimerchant-python,代碼行數:10,代碼來源:keys.py


注:本文中的ecdsa.VerifyingKey.from_public_point方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。