From 74dfea1e2fbcd0dd0cdb8ddcd81179528398c371 Mon Sep 17 00:00:00 2001 From: Brian McGrail Date: Thu, 26 Jun 2025 23:17:06 -0500 Subject: [PATCH] Fix crash on missing ripemd160 hash function; add troubleshooting guide --- README.md | 13 +++++++++++++ lbry/crypto/hash.py | 9 ++++++++- 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index d47367a92..0f5add90b 100644 --- a/README.md +++ b/README.md @@ -54,3 +54,16 @@ The documentation for the API can be found [here](https://lbry.tech/api/sdk). Daemon defaults, ports, and other settings are documented [here](https://lbry.tech/resources/daemon-settings). Settings can be configured using a daemon-settings.yml file. An example can be found [here](https://github.com/lbryio/lbry-sdk/blob/master/example_daemon_settings.yml). + +## Troubleshooting + +### Error: unsupported hash type 'ripemd160' + +If you see this error when running `lbrynet start`, it likely means your OpenSSL or Python installation is missing RIPEMD160 support. + +To fix it: + +- Ensure you are using a version of Python compiled with OpenSSL support. +- On Ubuntu/Debian, try: `sudo apt install libssl-dev` and reinstall Python. +- Alternatively, use a precompiled Python version (e.g., via `pyenv install 3.8.18` after `libssl-dev` is installed). + diff --git a/lbry/crypto/hash.py b/lbry/crypto/hash.py index 4f2eb728c..b95a5e1ff 100644 --- a/lbry/crypto/hash.py +++ b/lbry/crypto/hash.py @@ -15,11 +15,18 @@ def sha512(x): def ripemd160(x): """ Simple wrapper of hashlib ripemd160. """ - h = hashlib.new('ripemd160') + try: + h = hashlib.new('ripemd160') + except ValueError as e: + raise RuntimeError( + "Your Python/OpenSSL installation does not support RIPEMD160. " + "Try reinstalling Python with full OpenSSL support." + ) from e h.update(x) return h.digest() + def double_sha256(x): """ SHA-256 of SHA-256, as used extensively in bitcoin. """ return sha256(sha256(x))