Dav*_*ith 1 php encryption md5 social-networking
我想制作一个链接到社交引擎数据库的其他注册页面,但是当我对密码进行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;
}
Run Code Online (Sandbox Code Playgroud)
谢谢
小智 5
社交引擎使用默认安全盐,用户盐和用户密码的组合来加密密码,因此您只需将这三个数据组合并转换为md5。
$enc_password = md5('default_decurity_salt','user_password','user_salt');
前任。- MD5('6e3cf54ce0aa10bb69d69926e82b62b3be9022b9'.'123456'.'3486524');?
它会起作用。