-
Notifications
You must be signed in to change notification settings - Fork 198
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 #305
Comments
Openssl appears to have made it more difficult to use ripemd160 (see openssl/openssl#16994), which means that hashlib may not have ripemd160, depending on what version of openssl is available on the system where it is being used. |
A potential solution is to overwrite However this would affect all uses of |
@achow101 Would you consider a PR to use wally - https://github.com/ElementsProject/libwally-core ? While its not pure python, we currently build for most arches and its available on PyPI (https://pypi.org/project/wallycore/). Wally provides dependency-free, fast versions of the hash functions listed above, in addition it also provides a number of other HWI requirements like base58/64, script functions, bip32, bech32(+m) etc which could be migrated to if desired. Note wally is already used in the firmware for both Jade and bitbox02. If you are interested, I'm happy to hack up a strawman PR. |
I don't think wally would be useful in this regard. The ultimate goal is to remove openssl from python, which inherently requires removing hashlib from HWI and all of its dependencies. While HWI switching to wally would resolve that for HWI, there will still be dependencies that rely on hashlib. Furthermore, the functions that wally implements are already implemented in HWI; I don't think that wally provides us with any additional benefit. |
hashlib
depends on openssl which both increases the size of our pyinstaller build, and adds additional reproducibility headaches. It would be nice if we could drophashlib
for something that is lighter. Preferably something that is pure python or a cython module.The hash functions we use are:
Trying to get rid of
hashlib
could be a problem as a ton of things use it so any dependencies would not have to usehashlib
, and that would be a pain to figure out. Alternatively, for the deterministic build, we could drop-in replace thehashlib
module with whatever alternative implementation. That way nothing has to change, just the api needs to be the same ashashlib
.The text was updated successfully, but these errors were encountered: