Skip to content

Commit 3a5ec11

Browse files
committed
remove openssl fallback for ripemd160, always use pure-python implementation
1 parent 27fa0e8 commit 3a5ec11

File tree

1 file changed

+2
-11
lines changed

1 file changed

+2
-11
lines changed

bitcoin/core/serialize.py

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@
2020

2121
from io import BytesIO
2222

23+
from bitcoin.core.contrib.ripemd160 import ripemd160
24+
2325
MAX_SIZE = 0x02000000
2426

2527

@@ -29,17 +31,6 @@ def Hash(msg):
2931

3032
def Hash160(msg):
3133
"""RIPEME160(SHA256(msg)) -> bytes"""
32-
try:
33-
# This will fail with newer versions of OpenSSL such as included in
34-
# Ubuntu 22.04 as OpenSSL no longer includes ripemd160 by default.
35-
hashlib.new('ripemd160')
36-
def ripemd160(msg):
37-
return hashlib.new('ripemd160', msg).digest()
38-
except:
39-
# If OpenSSL ripemd160 provided by hashlib fails, use the pure
40-
# python implementation instead
41-
from bitcoin.core.contrib.ripemd160 import ripemd160
42-
4334
return ripemd160(hashlib.sha256(msg).digest())
4435

4536
class SerializationError(Exception):

0 commit comments

Comments
 (0)