如何使用python创建$ 2y $ 14河豚哈希



我正在设置一个新的Fedora 29盒子,并希望从python创建BLF-CRYPT密码。我想创建 $2y$ 哈希,但无论我尝试什么,它都不会超过 $2b$。最初它只做了2a$。因此,我发布了:

pip uninstall py-bcrypt
pip install passlib
pip install bcrypt

密码由以下人员创建:

from passlib.hash import bcrypt
hashed = bcrypt.using(rounds=14).hash("test")
hash
'$2b$14$9sAGvDrV0YEF3BBbofYCz.dNSaJZRDw2vfkFDY/5cwQzAxMNP4MVO'

如何创建 $2y$ 哈希?

根据官方文档,您可以将ident用作参数。

bcrypt.using(rounds=14, ident="2y").hash("test")

最新更新