The hash160 implementation at
|
def hash160(data): |
|
"""{data} must be bytes, returns ripemd160(sha256(data))""" |
|
assert isinstance(data, bytes) |
|
return hashlib.new("ripemd160", sha256(data)).digest() |
uses hashlib to create a
ripemd160 digest. The
ripemd160 digest is not among
hashlib's guaranteed algorigthms so this function may fail on some platforms with a
ValueError: unsupported hash type ripemd message. I experienced this while trying to run liana's tests.
Would it be a bad idea to check for the presence of 'ripemd160' in hashlib.algorithms_available and output an appropriate error message before trying to create the ripemd160 digest?
The
hash160implementation atpython-bip380/bip380/utils/hashes.py
Lines 14 to 17 in d2f5d8f
ripemd160digest. Theripemd160digest is not among hashlib's guaranteed algorigthms so this function may fail on some platforms with aValueError: unsupported hash type ripemdmessage. I experienced this while trying to run liana's tests.Would it be a bad idea to check for the presence of 'ripemd160' in
hashlib.algorithms_availableand output an appropriate error message before trying to create the ripemd160 digest?