python - 使用自定义 key 和算法ripemd160创建哈希值

标签 python ripemd

这是我在 Python 中尝试过的代码,但出现了 AttributeError:

>>> import hmac
>>> import hashlib
>>> h=hashlib.new('ripemd160')
>>> hmac.new("bedford","Hello",hashlib.ripemd160)
    Traceback (most recent call last):
    File "<stdin>", line 1, in <module>
    AttributeError: module 'hashlib' has no attribute 'ripemd160'

我搜索了 Python 文档和很多论坛,但没有找到太多关于ripemd160 和 Python 的信息。

最佳答案

ripemd160 不受 hashlib 模块直接支持:

>>> hashlib.algorithms 

A tuple providing the names of the hash algorithms guaranteed to be supported by this module.

该模块支持以下内容:md5、sha1、sha224、sha256、sha384、sha512

因此您需要再次使用 new 构造函数或将引用传递给已创建的构造函数。

关于python - 使用自定义 key 和算法ripemd160创建哈希值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37627879/

相关文章:

python - 在 Python 中使用 hashlib 检测可用的非标准哈希算法

C++ OpenSSL Ripemd-160 给出了错误的输出

python - 如何在python中导入ssl、socket模块

python - 对于在浏览器中显示良好的网站,urllib2 返回 404

python - lxml cssselect 解析

python - 在Python中解压ripemd160结果

java - 衬垫 RIPEMD 160

python - 查找具有不同键的 2 个字典列表之间的不同值

python - 无法在win7上安装Cython