【发布时间】:2010-07-17 17:58:12
【问题描述】:
我想创建一个链接到社交引擎数据库的另一个注册页面,但是当我 MD5 密码并将其存储在 se_users 表中时,用户无法登录,我相信社交引擎有另一种加密方法,谁能给我一个以社交引擎方式加密密码的功能?
这是他们的功能,但我不知道如何在我的脚本上实现它:
function user_password_crypt($user_password)
{
global $setting;
if( !$this->user_exists )
{
$method = $setting['setting_password_method'];
$this->user_salt = randomcode($setting['setting_password_code_length']);
}
else
{
$method = $this->user_info['user_password_method'];
}
// For new methods
if( $method>0 )
{
if( !empty($this->user_salt) )
{
list($salt1, $salt2) = str_split($this->user_salt, ceil(strlen($this->user_salt) / 2));
$salty_password = $salt1.$user_password.$salt2;
}
else
{
$salty_password = $user_password;
}
}
$user_password_crypt = md5($salty_password);
return $user_password_crypt;
}
谢谢
【问题讨论】:
-
你的意思是散列,而不是加密。
标签: php encryption md5 social-networking