【问题标题】:hashlib.pbkdf2_hmac not found on AWS CentOS instance在 AWS CentOS 实例上找不到 hashlib.pbkdf2_hmac
【发布时间】:2014-11-06 01:29:01
【问题描述】:

我在标准 AWS CentOS 实例上运行 Python 应用程序。当代码尝试调用 hashlib.pbkdf2_hmac 时,它会引发 AttributeError 异常。代码如下:

import hashlib, binascii

hashed_password = binascii.hexlify(hashlib.pbkdf2_hmac(result.encryption_method, bytearray(password.encode('utf_32')), binascii.a2b_uu(result.salt), result.encryption_rounds))

我已经运行yum update,希望将 Python 2.7 更新到最新版本,但这并没有帮助。有关如何获取 hashlib.pbkdf2_hmac 的任何帮助?

【问题讨论】:

    标签: python amazon-web-services hashlib


    【解决方案1】:

    pbkdf2_hmac 只是作为 PEP 466 的一部分添加到 Python 2.7.8 中的 hashlib 中。

    我建议安装 python-passlib 包并使用passlib,因为 CentOS 没有 Python 2.7.8。

    【讨论】:

    • 我会检查 passlib。感谢您的提示!
    猜你喜欢
    • 2021-05-24
    • 2013-11-20
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-01-20
    • 1970-01-01
    • 2017-10-27
    • 1970-01-01
    相关资源
    最近更新 更多