本文整理汇总了Python中btctxstore.BtcTxStore.verify_signature_unicode方法的典型用法代码示例。如果您正苦于以下问题:Python BtcTxStore.verify_signature_unicode方法的具体用法?Python BtcTxStore.verify_signature_unicode怎么用?Python BtcTxStore.verify_signature_unicode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类btctxstore.BtcTxStore
的用法示例。
在下文中一共展示了BtcTxStore.verify_signature_unicode方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: TestSignUnicode
# 需要导入模块: from btctxstore import BtcTxStore [as 别名]
# 或者: from btctxstore.BtcTxStore import verify_signature_unicode [as 别名]
class TestSignUnicode(unittest.TestCase):
def setUp(self):
self.api = BtcTxStore(dryrun=True, testnet=True)
def test_sign_a(self):
wif = fixtures["wallet"]["wif"]
message = u"üöä"
address = self.api.get_address(wif)
sig = self.api.sign_unicode(wif, message)
valid = self.api.verify_signature_unicode(address, sig, message)
self.assertEqual(valid, True)
def test_sign_b(self):
wif = "cSuT2J14dYbe1zvB5z5WTXeRcMbj4tnoKssAK1ZQbnX5HtHfW3bi"
message = u"üöä"
address = self.api.get_address(wif)
sig = self.api.sign_unicode(wif, message)
valid = self.api.verify_signature_unicode(address, sig, message)
self.assertEqual(valid, True)
示例2: verify_signature
# 需要导入模块: from btctxstore import BtcTxStore [as 别名]
# 或者: from btctxstore.BtcTxStore import verify_signature_unicode [as 别名]
def verify_signature(msg, wif, node_id=None): # FIXME use read instead
assert(isinstance(msg, OrderedDict))
if u"signature" not in msg:
return 0
msg = msg.copy() # work on a copy for thread saftey
sig = msg.pop("signature")
# Use our address.
api = BtcTxStore(testnet=False, dryrun=True)
try:
if node_id is None:
address = api.get_address(wif)
ret = api.verify_signature_unicode(address, sig, str(msg))
else:
address = node_id_to_address(node_id)
ret = api.verify_signature_unicode(address, sig, str(msg))
except TypeError:
return 0
return ret
示例3: BtcTxStore
# 需要导入模块: from btctxstore import BtcTxStore [as 别名]
# 或者: from btctxstore.BtcTxStore import verify_signature_unicode [as 别名]
from __future__ import print_function
from __future__ import unicode_literals
from btctxstore import BtcTxStore
import time
import cProfile
from pstats import Stats
api = BtcTxStore(testnet=True, dryrun=True) # use testing setup for example
wif = api.create_key() # create new private key
address = api.get_address(wif) # get private key address
message = "Signed ünicöde message."
signature = api.sign_unicode(wif, message)
profile = cProfile.Profile()
profile.enable()
begin = time.time()
for i in range(10):
assert(api.verify_signature_unicode(address, signature, message))
end = time.time()
stats = Stats(profile)
stats.strip_dirs()
stats.sort_stats('cumtime')
stats.print_stats()
print(end - begin)