From cf9902f59898f36d14d226644a687fa3515614c3 Mon Sep 17 00:00:00 2001 From: Pieter Wuille Date: Wed, 8 Dec 2021 14:17:08 -0500 Subject: [PATCH] Swap out hashlib.ripemd160 for own implementation Github-Pull: 23716 Rebased-From: 5b559dc7ecf37ab1604b75ec8ffe8436377a5fb1 (cherry picked from commit ea3e028bcc99b2e3ddc4c9e96eb487f4e5418b3f) --- test/functional/test_framework/script.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/test/functional/test_framework/script.py b/test/functional/test_framework/script.py index d5c318455b0..a0a26d4a6d6 100644 --- a/test/functional/test_framework/script.py +++ b/test/functional/test_framework/script.py @@ -8,7 +8,6 @@ """ from collections import namedtuple -import hashlib import struct import unittest from typing import List, Dict @@ -29,6 +28,8 @@ uint256_from_str, ) +from .ripemd160 import ripemd160 + MAX_SCRIPT_ELEMENT_SIZE = 520 LOCKTIME_THRESHOLD = 500000000 ANNEX_TAG = 0x50 @@ -36,7 +37,7 @@ LEAF_VERSION_TAPSCRIPT = 0xc4 def hash160(s): - return hashlib.new('ripemd160', sha256(s)).digest() + return ripemd160(sha256(s)) def bn2vch(v): """Convert number to bitcoin-specific little endian format."""