Podcastindex-org / podping-hivewriter

The hive writer component of podping.
MIT License
15 stars 5 forks source link

Unsupported hash type ripemd160 when checking if the provided posting key is allowed for the given Hive account #47

Closed agates closed 2 years ago

agates commented 2 years ago

Operating systems shipping with openssl 3.0 by default do not have the ripemd160 algorithm available.

This is causing podping-hivewriter to fail when using lighthive to convert the public key to a string to check its validity.

Removing string conversion works around the error, but then doesn't check if the public key belongs to the account.


  File "/home/agates/src/Podcastindex-org/podping-hivewriter/src/podping_hivewriter/cli/podping.py", line 383, in callback
    if not str(private_key.pubkey) in public_keys:
  File "/home/agates/.cache/pypoetry/virtualenvs/podping-hivewriter-GQ5UIonf-py3.10/lib/python3.10/site-packages/lighthive/broadcast/key_objects.py", line 144, in __str__
    return format(self._pk, self.prefix)
  File "/home/agates/.cache/pypoetry/virtualenvs/podping-hivewriter-GQ5UIonf-py3.10/lib/python3.10/site-packages/lighthive/broadcast/base58.py", line 79, in __format__
    return _format.upper() + str(self)
  File "/home/agates/.cache/pypoetry/virtualenvs/podping-hivewriter-GQ5UIonf-py3.10/lib/python3.10/site-packages/lighthive/broadcast/base58.py", line 97, in __str__
    return gphBase58CheckEncode(self._hex)
  File "/home/agates/.cache/pypoetry/virtualenvs/podping-hivewriter-GQ5UIonf-py3.10/lib/python3.10/site-packages/lighthive/broadcast/base58.py", line 179, in gphBase58CheckEncode
    checksum = ripemd160(s)[:4]
  File "/home/agates/.cache/pypoetry/virtualenvs/podping-hivewriter-GQ5UIonf-py3.10/lib/python3.10/site-packages/lighthive/broadcast/base58.py", line 154, in ripemd160
    ripemd160 = hashlib.new('ripemd160')
  File "/usr/lib64/python3.10/hashlib.py", line 166, in __hash_new
    return __get_builtin_constructor(name)(data)
  File "/usr/lib64/python3.10/hashlib.py", line 123, in __get_builtin_constructor
    raise ValueError('unsupported hash type ' + name)
ValueError: unsupported hash type ripemd160```
agates commented 2 years ago

See https://stackoverflow.com/a/72508879/4875332 for possible details on how to re-enable the ripemd160 algorithm in openssl.