Default Encryption type of password in laravel

孤街浪徒 提交于 2020-05-14 19:27:05

问题


i am new to Laravel and just curious to know what type of encryption is used for password in Laravel by default.In case if we want to change the password in db then how we can identify the encryption type of password.

Thanks in advance. :)


回答1:


According to Laravel Documentation :

The Laravel Hash facade provides secure Bcrypt hashing for storing user passwords. If you are using the AuthController controller that is included with your Laravel application, it will be take care of verifying the Bcrypt password against the un-hashed version provided by the user.

Likewise, the user Registrar service that ships with Laravel makes the proper bcrypt function call to hash stored passwords.

Hashing A Password Using Bcrypt

$password = Hash::make('secret');

You may also use the bcrypt helper function:

$password = bcrypt('secret');

Verifying A Password Against A Hash

if (Hash::check('secret', $hashedPassword))
{
    // The passwords match...
}

Checking If A Password Needs To Be Rehashed

if (Hash::needsRehash($hashed))
{
    $hashed = Hash::make('secret');
}


来源:https://stackoverflow.com/questions/42290902/default-encryption-type-of-password-in-laravel

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!