def verify(pubkey, message, signature):
'''???? pubkey:hex pubkey, not hex_compressed'''
vk = ecdsa.VerifyingKey.from_string(binascii.unhexlify(pubkey[2:]), curve=ecdsa.SECP256k1, hashfunc = hashlib.sha256)
try:
return vk.verify(binascii.unhexlify(signature), binascii.unhexlify(message))
except ecdsa.BadSignatureError:
return False
评论列表
文章目录