0
hash_pbkdf2를 사용하는 해시 패스워드가있는 기존 테이블이 있습니다. 사용자 등록을 위해서는 mysql에 성공적으로 삽입하십시오.laravel php pbkdf2 로그인 인증
$string = mcrypt_create_iv(24, MCRYPT_DEV_URANDOM);
$salt = strtoupper(bin2hex($string));
$hash = hash_pbkdf2("sha1", $data['password'], $string, 1000, 24, true);
$hash = strtoupper(bin2hex($hash));
return User::create([
'name' => $data['name'],
'email' => $data['email'],
'hashedpassword' => $hash,
'salt' => $salt,
]);
나는 그것을 사용하는 데 문제가 있습니다. 여기 내 코드
$found_salt = DB::table('users')->where('email', '[email protected]')->first();
$salt = $found_salt->salt;
echo "Salt : ".$salt."<br>";
$hash = hash_pbkdf2("sha1", "password", $salt, 1000, 24, true);
$hash = strtoupper(bin2hex($hash));
$userlogin = [
'email' => "[email protected]",
'hashedpassword' => $hash
];
echo "Hash : ".$hash."<br>";
if(Auth::attempt($userlogin)) {
echo "success";
} else {
echo "not success";
}
소금 값은 동일하지만 해시 값이 일치하지 않습니다. 누군가가 도움이되기를 바랍니다. 감사.