【问题标题】:What is `$6$rounds=` when running Passlib with Python?使用 Python 运行 Passlib 时,“$6$rounds=”是什么?
【发布时间】:2016-10-07 04:20:15
【问题描述】:

我正在使用 Python 的 Passlib 的命令生成 SHA-512 编码的密码密钥。

python -c "from passlib.hash import sha512_crypt; import getpass; print sha512_crypt.encrypt(getpass.getpass())"

这是根据 Ansible 文档:http://docs.ansible.com/ansible/faq.html#how-do-i-generate-crypted-passwords-for-the-user-module)。

它提示我输入密码。然后它返回密钥。

无论我输入什么密码,创建的所有密钥都以$6$rounds=...开头

这是什么意思?这是钥匙的一部分吗?

【问题讨论】:

    标签: python encryption passlib


    【解决方案1】:

    这表明所用算法的架构。对于sha512_crypt6 表示sha512rounds=x 表示计算哈希的轮数。

    当前的NIST 标准也建议使用pbkdf2_sha256 进行密码散列。

    【讨论】:

    • 使用key时是否应该在字符串中包含round?
    • @tim_zyx passlib 的sha256_crypt manpage 的“格式”部分描述了哈希字符串的完整格式。 sha512_crypt 具有相同的格式,只是 $6$ 和更长的摘要。
    猜你喜欢
    • 2012-11-12
    • 2016-11-25
    • 2011-04-23
    • 2017-10-19
    • 2019-11-15
    • 1970-01-01
    • 1970-01-01
    • 2020-12-25
    • 2011-03-03
    相关资源
    最近更新 更多