本文整理汇总了Python中Crypto.Hash.RIPEMD160类的典型用法代码示例。如果您正苦于以下问题:Python RIPEMD160类的具体用法?Python RIPEMD160怎么用?Python RIPEMD160使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了RIPEMD160类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: sharip
def sharip(*args):
h= SHA256.new()
for x in args:
h.update(x)
h2= RIPEMD160.new()
h2.update(h.digest())
return h2.digest()
示例2: test
def test(nb_chunks, chunk_size):
h = RIPEMD160.new()
f = open('test.txt', 'rb')
for i in range(nb_chunks):
h.update(f.read(chunk_size))
f.close()
d = h.hexdigest()
示例3: test_negative_unapproved_hashes
def test_negative_unapproved_hashes(self):
"""Verify that unapproved hashes are rejected"""
from Crypto.Hash import RIPEMD160
self.description = "Unapproved hash (RIPEMD160) test"
hash_obj = RIPEMD160.new()
signer = DSS.new(self.key_priv, 'fips-186-3')
self.assertRaises(ValueError, signer.sign, hash_obj)
self.assertRaises(ValueError, signer.verify, hash_obj, b("\x00") * 40)
示例4: pubkey_to_hash
def pubkey_to_hash(pubkey):
return RIPEMD160.new(SHA256.new(pubkey).digest()).digest()
示例5: _ripemd160_new
def _ripemd160_new(*args):
from Crypto.Hash import RIPEMD160
_new_funcs['RIPEMD160'] = _new_funcs['ripemd160'] = _new_funcs['RIPEMD'] = _new_funcs['ripemd'] = RIPEMD160.new
return RIPEMD160.new(*args)
示例6: hash_160
def hash_160(public_key):
if not have_crypto:
return ''
h1 = SHA256.new(public_key).digest()
h2 = RIPEMD160.new(h1).digest()
return h2