1 <?php
2 $pass = '123456';
3 echo "MD5加密后".md5($pass)."<br>"; //不安全
4 echo "crypt加密后".crypt($pass)."<br>"; // 比较乱的密码 刷新后还会变
5 echo "crypt复杂加密后".crypt($pass,substr($pass,0,2))."<br>"; //还是不爽
6 echo "无敌加密后".md5(crypt($pass,substr($pass,0,2)))."<br>"; // 现在让黑客如何破这个密码???
7
8 //最后的密码 还是32位 初看 都以为是 MD5加密
9 //可无论对方MD5的HASH值多么庞大 几个T的数据 都无法破解出来
10 ?>
2 $pass = '123456';
3 echo "MD5加密后".md5($pass)."<br>"; //不安全
4 echo "crypt加密后".crypt($pass)."<br>"; // 比较乱的密码 刷新后还会变
5 echo "crypt复杂加密后".crypt($pass,substr($pass,0,2))."<br>"; //还是不爽
6 echo "无敌加密后".md5(crypt($pass,substr($pass,0,2)))."<br>"; // 现在让黑客如何破这个密码???
7
8 //最后的密码 还是32位 初看 都以为是 MD5加密
9 //可无论对方MD5的HASH值多么庞大 几个T的数据 都无法破解出来
10 ?>
1 <?php
2 $password = crypt('mypassword'); // let the salt be automatically generated
3
4 /* You should pass the entire results of crypt() as the salt for comparing a
5 password, to avoid problems when different hashing algorithms are used. (As
6 it says above, standard DES-based password hashing uses a 2-character salt,
7 but MD5-based hashing uses 12.) */
8 if (crypt($user_input, $password) == $password) {
9 echo "Password verified!";
10 }
11 ?>
2 $password = crypt('mypassword'); // let the salt be automatically generated
3
4 /* You should pass the entire results of crypt() as the salt for comparing a
5 password, to avoid problems when different hashing algorithms are used. (As
6 it says above, standard DES-based password hashing uses a 2-character salt,
7 but MD5-based hashing uses 12.) */
8 if (crypt($user_input, $password) == $password) {
9 echo "Password verified!";
10 }
11 ?>