csok 发表于 2012-5-15 15:37:29

密码MD5加密问题

目的:
游客发布供求后根据他的邮箱自动生成一组账号密码[*]/*随机密码函数*/
[*]function GetRandStr($len)
[*]{
[*]    $chars = array(
[*]      "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k",
[*]      "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v",
[*]      "w", "x", "y", "z", "A", "B", "C", "D", "E", "F", "G",
[*]      "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R",
[*]      "S", "T", "U", "V", "W", "X", "Y", "Z", "0", "1", "2",
[*]      "3", "4", "5", "6", "7", "8", "9"
[*]    );
[*]    $charsLen = count($chars) - 1;
[*]    shuffle($chars);   
[*]    $output = "";
[*]    for ($i=0; $i复制代码$pass = GetRandStr(6); //加密前密码
$password =md5($pass);//MD5加密后的密码
为什么加密后,不能用加密前的密码登录?

csok 发表于 2012-5-15 15:42:39


看了下 注册
原来加密了两次
应该这样写
$password =md5(md5($pass));//MD5加密后的密码


http://bbs.destoon.com/static/image/smiley/default/victory.gif

http://bbs.destoon.com/static/image/smiley/default/victory.gif
页: [1]
查看完整版本: 密码MD5加密问题