【发布时间】:2014-11-22 00:28:49
【问题描述】:
我正在寻求一些建议来保护我的密码编码。在这里我想提一下,我不想使用新的password_hash() api,也不想迁移旧密码,如果我使用password_hash() api,我必须迁移我的旧用户密码,这不是目前可能。所以这是我的旧方法。
function login() {
//the code of getting password from database.......I am skipping this part.....
if(!Check($given_pass,$expected_pass)))
//User enter a password in the session as given_pass and expected_pass is the md5 generated hash password stored in database.
return error('pass error');
return notice('pass success');
}
function Encode($text) {
return md5(paramtr2Str("conf.cryptographykey").$text);
//cryptography key is a random generated string at the server side.
}
function Check($given_pass, $expected_pass) {
return $expected == Encode($given_pass);
}
我认为我的 Encode 函数是可破解的,我想通过坚持原始格式来给它一些额外的安全性。
【问题讨论】:
-
“可破解”是什么意思?让我们清楚一点; MD5 不是加密安全的。如果你想要一个安全的系统,前提是不要使用 MD5。
-
保护您的 md5 的最佳方式,停止使用 md5 并开始使用 password_hash(),即使您不想这样做.... 询问人们如何保护系统,同时告诉他们您不会这样做'不接受最好的建议并不是寻求帮助的特别明智的方法
-
256 位或者什么都没有!好吧,当量子计算真正开始时,我们都已经筋疲力尽了,但与此同时,我们选择了生活。选择 256 位+
-
我知道 password_hash() 更安全。但由于某些限制,我现在无法迁移系统。可能稍后我会逐渐迁移。但现在我需要一个临时解决方案。 .
-
对当前散列密码应用
sha1怎么样?那么你需要使用sha1(md5(...))来获取保存的哈希值。
标签: php hash cryptography passwords md5