Skip to content

Commit 7910ad2

Browse files
caryosceluscanewsin
authored andcommitted
fix compatibility with modern hashlib
ripemd160 has been removed from hashlib, we have to mend it with other implementation for now
1 parent be3c823 commit 7910ad2

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

src/lib/libsecp256k1message/libsecp256k1message.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
from base58 import b58encode_check, b58decode_check
55
from hmac import compare_digest
66
from util.Electrum import format as zero_format
7+
from ..sslcrypto._ecc import ripemd160
78

89
RECID_MIN = 0
910
RECID_MAX = 3
@@ -41,7 +42,7 @@ def compute_secret_address(secretkey):
4142
def public_digest(publickey, compressed=False):
4243
"""Convert a public key to ripemd160(sha256()) digest."""
4344
publickey_hex = publickey.format(compressed=compressed)
44-
return hashlib.new('ripemd160', hashlib.sha256(publickey_hex).digest()).digest()
45+
return ripemd160(hashlib.sha256(publickey_hex).digest()).digest()
4546

4647
def address_public_digest(address):
4748
"""Convert a public Bitcoin address to ripemd160(sha256()) digest."""

0 commit comments

Comments
 (0)