Skip to content

Commit

Permalink
Use ripemd-hash instead of hashlib for ripemd160
Browse files Browse the repository at this point in the history
  • Loading branch information
alecalve committed Mar 23, 2024
1 parent a1ba608 commit ef092ac
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
5 changes: 4 additions & 1 deletion blockchain_parser/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down
3 changes: 2 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
python-bitcoinlib==0.11.0
plyvel==1.5.1
coverage==7.4.4
ripemd-hash==1.0.1
coverage==7.4.4
3 changes: 2 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
],
install_requires=[
'python-bitcoinlib==0.11.0',
'plyvel==1.5.1'
'plyvel==1.5.1',
'ripemd-hash==1.0.1'
]
)

0 comments on commit ef092ac

Please sign in to comment.