diff --git a/blockchain_parser/utils.py b/blockchain_parser/utils.py index fd04a89..407b9b2 100644 --- a/blockchain_parser/utils.py +++ b/blockchain_parser/utils.py @@ -12,10 +12,13 @@ import hashlib import struct +from ripemd import ripemd160 def btc_ripemd160(data): + """Computes ripemd160(sha256(data))""" + h1 = hashlib.sha256(data).digest() - r160 = hashlib.new("ripemd160") + r160 = ripemd160.new() r160.update(h1) return r160.digest() diff --git a/requirements.txt b/requirements.txt index 62477e9..c751a70 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,3 +1,4 @@ python-bitcoinlib==0.11.0 plyvel==1.5.1 -coverage==7.4.4 \ No newline at end of file +ripemd-hash==1.0.1 +coverage==7.4.4 diff --git a/setup.py b/setup.py index 4f9bd63..214e177 100644 --- a/setup.py +++ b/setup.py @@ -20,6 +20,7 @@ ], install_requires=[ 'python-bitcoinlib==0.11.0', - 'plyvel==1.5.1' + 'plyvel==1.5.1', + 'ripemd-hash==1.0.1' ] )