0
我使用以下script from the passlib docs哈希密碼:爲什麼這個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"
這似乎很奇怪的是sha256_crypt.verify
將能夠驗證多個不同的散列爲「toomanysecrets」 - 爲什麼沒有這個密碼只有一個哈希?
'生成新鹽' –