【发布时间】:2013-07-05 05:52:10
【问题描述】:
我有一个用于我的网站的真正简单的加密。我正在尝试将我的所有代码从 php 转换为 python,但我不知道如何让 python 产生与 php 对这段代码所做的相同的输出。
function myhash($word){
$salt = "$2a$06$" . substr(sha1($word) , 0, 22) . "$";
return crypt($word, $salt);
}
鉴于我已经使用此加密存储了相当多的密码,因此进行新的加密将是愚蠢的。怎么办?
【问题讨论】:
-
这个模块可能有你想要的:docs.python.org/2/library/crypt.html
-
请注意,Blowfish 与 bcrypt 不同。
标签: php python encryption salt blowfish