使用 MD5 和 SHA1 进行多次哈希
Multiple times hashing with MD5 and SHA1
能否同时使用 md5 和 sha1 对同一变量进行多次哈希处理,使字符串更难解密并提高安全性?
能否连接同一个字符串的 MD5 和 SHA1 版本,然后最后使用 password_hash()
再次对其进行哈希处理,求助?
Can concatenating the MD5 and SHA1 versions of same string and then finally hashing it once more with either password_hash(), help?"
不,只是 "no"。这只会让事情变得更糟。
您不需要甚至不应该多次使用 MD5/SHA1 和 password_hash()
;你只需要使用一次; "it" 是 password_hash()
。如果你多次使用那个,你的验证将不起作用,相信我。
您将只是对一个哈希和另一个哈希进行哈希处理,您将无法验证它以便在验证时匹配密码。
在尝试这样做时,您的方法将失败。
您使用 password_hash()
一次,然后使用 password_verify()
进行验证。
参考文献:
- http://php.net/manual/en/function.password-hash.php
- http://php.net/manual/en/function.password-verify.php
"Can hashing the same variable multiples times using both md5 and sha1, makes the string more difficult to decrypt and increase security?"
关于将其用于密码存储,它实际上没有多大用处,而且那些(散列)函数已经过时了。
但是,这并不能阻止您将它们用于其他用途;例如在帐户验证时发送给用户的令牌。然而,有一些更好的方法可以做到这一点,但超出了问题的范围。
能否同时使用 md5 和 sha1 对同一变量进行多次哈希处理,使字符串更难解密并提高安全性?
能否连接同一个字符串的 MD5 和 SHA1 版本,然后最后使用 password_hash()
再次对其进行哈希处理,求助?
Can concatenating the MD5 and SHA1 versions of same string and then finally hashing it once more with either password_hash(), help?"
不,只是 "no"。这只会让事情变得更糟。
您不需要甚至不应该多次使用 MD5/SHA1 和 password_hash()
;你只需要使用一次; "it" 是 password_hash()
。如果你多次使用那个,你的验证将不起作用,相信我。
您将只是对一个哈希和另一个哈希进行哈希处理,您将无法验证它以便在验证时匹配密码。
在尝试这样做时,您的方法将失败。
您使用 password_hash()
一次,然后使用 password_verify()
进行验证。
参考文献:
- http://php.net/manual/en/function.password-hash.php
- http://php.net/manual/en/function.password-verify.php
"Can hashing the same variable multiples times using both md5 and sha1, makes the string more difficult to decrypt and increase security?"
关于将其用于密码存储,它实际上没有多大用处,而且那些(散列)函数已经过时了。
但是,这并不能阻止您将它们用于其他用途;例如在帐户验证时发送给用户的令牌。然而,有一些更好的方法可以做到这一点,但超出了问题的范围。