如何解码密码: $password = md5( addslashes( $_POST['password'] ) );

How to decode the password: $password = md5( addslashes( $_POST['password'] ) );

如标题,请教我如何解码这样编码的密码字符串:

$password = md5( addslashes( $_POST['password'] ) );

例如:f21601fea7f496cfbc23f7310e13f941

谢谢!

MD5 是一种单向 hashing algorithm。这种算法的本质是不可逆。它可以,它是一种加密算法,而不是散列。

在您切换到加密算法之前,不要。如果可能,密码应始终存储为哈希值(有一些不寻常的情况,例如您存储第三方系统的密码)。如果您的 code/database 受到威胁,这可以保护您的用户。

对于简单的字符串,可以在 "rainbow table" 中查找 MD5 散列。例如,098f6bcd4621d373cade4e832627b4f6 可以放入 http://md5cracker.org/ to find out the password is probably test (but it could be another string that results in the same hash, known as a collision).

这样的工具中

注意: MD5 也是 insecure 因为你可以生成彩虹的速度 table。在散列密码时,您应该使用 PHP 内置的 password_hash / password_verify 函数,因为它们利用了安全的 bcrypt 散列算法。