我正在使用passlib 文档中的以下脚本来散列密码:
# import the hash algorithm
from passlib.hash import sha256_crypt
# generate new salt, and hash a password
hash = sha256_crypt.encrypt("toomanysecrets")
print hash # <== WHY IS THIS ALWAYS A DIFFERENT STRING?
# verifying the password
print sha256_crypt.verify("toomanysecrets", hash) # Outputs "True"
print sha256_crypt.verify("joshua", hash) # Outputs "False"
能够将多个不同的哈希验证为“toomanysecrets”似乎很奇怪sha256_crypt.verify
——为什么这个密码没有一个哈希?