2018-05-26 14:43:21 +02:00
|
|
|
"""
|
|
|
|
.. todo:: hello world
|
|
|
|
"""
|
2019-01-31 16:42:22 +01:00
|
|
|
|
|
|
|
import hashlib
|
|
|
|
|
|
|
|
# We need to check hashlib for RIPEMD-160, as it won't be available
|
|
|
|
# if OpenSSL is not linked against or the linked OpenSSL has RIPEMD
|
|
|
|
# disabled.
|
|
|
|
|
|
|
|
try:
|
|
|
|
hashlib.new('ripemd160')
|
|
|
|
except ValueError:
|
|
|
|
try:
|
|
|
|
from Crypto.Hash import RIPEMD
|
|
|
|
except ImportError:
|
|
|
|
RIPEMD160Hash = None
|
|
|
|
else:
|
|
|
|
RIPEMD160Hash = RIPEMD.RIPEMD160Hash
|
|
|
|
else:
|
|
|
|
def RIPEMD160Hash(data=None):
|
|
|
|
"""hashlib based RIPEMD160Hash"""
|
|
|
|
hasher = hashlib.new('ripemd160')
|
|
|
|
if data:
|
|
|
|
hasher.update(data)
|
|
|
|
return hasher
|