在 laravel 5.0 中我们使用 bcrypt ,那么 bcrypt 实际上包含盐哈希吗?如果不是如何在正常的身份验证方法中添加盐?
In laravel 5.0 we use bcrypt , so is bcrypt actually contains salt hashing ? if not how to add salt to the normal authentication method?
这是使用 bcrypt 创建密码的代码。如何加盐?
public function create(array $data)
{
return User::create([
'name' => $data['name'],
'email' => $data['email'],
'password' => bcrypt($data['password']),
]);
}
是的,bcrypt](https://en.wikipedia.org/wiki/Bcrypt) 确实添加了盐。
来自维基百科文章:
Besides incorporating a salt to protect against rainbow table attacks, bcrypt is an adaptive function: over time, the iteration count can be increased to make it slower, so it remains resistant to brute-force search attacks even with increasing computation power.
这是使用 bcrypt 创建密码的代码。如何加盐?
public function create(array $data)
{
return User::create([
'name' => $data['name'],
'email' => $data['email'],
'password' => bcrypt($data['password']),
]);
}
是的,bcrypt](https://en.wikipedia.org/wiki/Bcrypt) 确实添加了盐。
来自维基百科文章:
Besides incorporating a salt to protect against rainbow table attacks, bcrypt is an adaptive function: over time, the iteration count can be increased to make it slower, so it remains resistant to brute-force search attacks even with increasing computation power.