-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Replace hashlib.ripemd160 with python-only implemenation #65
Conversation
Should have added type annotations |
beccdb7
to
e644986
Compare
Added type annotations. |
The Core's implementation is described as "Test-only" in bitcoin/bitcoin@68ca867 But here we would be using it in the 'body' of the library, not only in tests. We already use code from Core's test framework, for example, I wonder if it is OK to use the Core's test framework implementation of ripemd160. On one hand, it passes the tests and is quite simple (in the sense of 'relatively few lines of code'). On the other hand, it is "Test only". The code from Electrum (https://github.com/spesmilo/electrum/blob/0df05dd914c823acae1828cad3b20bdeb13150e9/electrum/ripemd.py) is more complex, and has comments like "parallel round 1", but I doubt that it is any faster, there's no automatic parallelization in python AFAIK, as it could be done by the C/C++ compiler that the original code seems to be written for. This code does not claim to be 'Test-only', though. |
It's marked as test-only just because of not being constant time, see code review discussion. bitcoin/bitcoin@ad3e9e1#r765393461 |
In bitcoin/bitcoin#23716 (review), @sipa says that it is 'Test-only' because it is not constant-time. So the question is, is it possible that someone will be using The data within I wonder if the implementation in Electrum is constant-time. |
Just in case, I've added another PR #67 which uses ripemd160 implementation taken from Electrum |
As a result of discussion in #67 (comment), I've moved the |
52bf3c8
to
2ff6739
Compare
squashed to make it single commit |
The implementation is taken from Bitcoin Core's test framework Closes #64
Merged in afac19c |
The implementation is taken from Bitcoin Core's test framework
Closes #64