MD5与Usercake和PHP121 Messenger的比较

时间:2015-03-12 18:36:16

标签: php encryption hash md5 usercake

我正在尝试将Php121 Messenger合并到现有网站中。该网站使用usercake帐户。

它无法识别密码,因为密码的md5加密类型。

Usercake使用此类加密

function generateHash($plainText, $salt = null)
{
if ($salt === null)
{
    $salt = substr(md5(uniqid(rand(), true)), 0, 25);
}
else
{
    $salt = substr($salt, 0, 25);
}

return $salt . sha1($salt . $plainText);
}

这是php121 messenger用于验证用户的功能。我有所有数据库设置正确,它找到用户名但密码不匹配,因为哈希格式

function userLookup($username, $password) {
global $php121db, $password;
global $db_usertable, $dbf_uid, $dbf_uname, $dbf_upassword, $dbf_passwordtype, $dbf_uemail;
global $dbf_user_chatting, $dbf_smilies, $dbf_level, $dbf_showrequest;
global $dbf_upassword_len;

    $stop = "";
    if (mysql_num_rows(mysql_query("SELECT $dbf_uname FROM $db_usertable WHERE $dbf_uname='$username'",$php121db)) == 0) $stop .= _USERNAME_NOT_FOUND . "<br>";
    if ($stop == ""){
            $row = mysql_fetch_row(mysql_query("SELECT $dbf_upassword from $db_usertable WHERE $dbf_uname='$username'", $php121db));
    if ($dbf_passwordtype == "md5") {
        if ($row[0] != substr(md5($password), 0, $dbf_upassword_len)) $stop .= _INCORRECT_PASSWORD . "<br>";
    } else if ($dbf_passwordtype == "plaintext") {
        if ($row[0] != substr($password, 0, $dbf_upassword_len)) $stop .= _INCORRECT_PASSWORD . "<br>";
    }
    else if ($dbf_passwordtype == "salted") { 
if ($row[0] != substr(md5(uniqid(rand(), true)), 0, 25)) $stop .= _INCORRECT_PASSWORD . "<br>"; 

 }
}
return($stop);
}

我需要弄清楚如何比较md5哈希

http://forums.php121.com/viewtopic.php?t=1162

尝试使用像joomla这样的东西,但没有运气。

任何帮助都将不胜感激。

由于

0 个答案:

没有答案