经过彻底搜索,我没有在整个网络上找到完整的解释和解决此非常普遍问题的方法。所有需要使用hashlib编码的脚本都给我报错:
Python 3.10
import hashlib
h = hashlib.new('ripemd160')
返回:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
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
我已经尝试检查库中是否存在该哈希值,并且我是否拥有它:
print(hashlib.algorithms_available)
: {'md5','sm3','sha3_512','sha384','sha256','sha1','shake_128','sha224','sha512_224','sha512_256','blake2b','ripemd160','md5-sha1','sha512','sha3_256','shake_256','sha3_384','whirlpool','md4','blake2s','sha3_224'}
我在一台运行Linux的VPS上遇到了这个问题,但是在我的PC上使用Windows时并没有遇到这个问题。
我真诚地感谢任何帮助或建议。