1
0
mirror of https://github.com/bitcoin/bips.git synced 2024-11-19 01:40:05 +01:00
bitcoin-bips/bip-0352
Sebastian Falbesoner 2a99b8f925
BIP-352: use own ripemd160 for reference implementation (#1616)
On some operating systems, Python doesn't provide the expected ripemd160
implementation anymore, so the reference implementation fails to start.
E.g. in Ubuntu 22.04:

----------------------------------------------------------------------------------------------
$ ./reference.py send_and_receive_test_vectors.json
Simple send: two inputs
Traceback (most recent call last):
  File "/usr/lib/python3.10/hashlib.py", line 160, in __hash_new
    return _hashlib.new(name, data, **kwargs)
ValueError: [digital envelope routines] unsupported

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/thestack/bips/bip-0352/./reference.py", line 228, in <module>
    pubkey = get_pubkey_from_input(vin)
  File "/home/thestack/bips/bip-0352/./reference.py", line 46, in get_pubkey_from_input
    pubkey_hash = hash160(pubkey_bytes)
  File "/home/thestack/bips/bip-0352/bitcoin_utils.py", line 130, in hash160
    return hashlib.new("ripemd160", hashlib.sha256(s).digest()).digest()
  File "/usr/lib/python3.10/hashlib.py", line 166, in __hash_new
    return __get_builtin_constructor(name)(data)
  File "/usr/lib/python3.10/hashlib.py", line 123, in __get_builtin_constructor
    raise ValueError('unsupported hash type ' + name)
ValueError: unsupported hash type ripemd160
----------------------------------------------------------------------------------------------

Fix this by providing a manual implementation, taken from the functional test framework
of Bitcoin Core. See corresponding issue https://github.com/bitcoin/bitcoin/issues/23710 and
PR https://github.com/bitcoin/bitcoin/pull/23716
2024-06-29 07:08:49 -07:00
..
bech32m.py Add reference.py with test vectors 2024-05-08 18:14:55 +02:00
bitcoin_utils.py BIP-352: use own ripemd160 for reference implementation (#1616) 2024-06-29 07:08:49 -07:00
reference.py BIP-352: scanning: add step to skip tx if input pubkeys sum A is point at infinity 2024-06-22 01:48:44 +02:00
ripemd160.py BIP-352: use own ripemd160 for reference implementation (#1616) 2024-06-29 07:08:49 -07:00
scan_data_downloader_per_month.png Add BIP for Silent Payments 2024-05-08 18:14:55 +02:00
secp256k1.py Add reference.py with test vectors 2024-05-08 18:14:55 +02:00
send_and_receive_test_vectors.json BIP-352: scanning: add step to skip tx if input pubkeys sum A is point at infinity 2024-06-22 01:48:44 +02:00