laravel中密码的默认加密类型 [英] Default Encryption type of password in laravel

查看:82
本文介绍了laravel中密码的默认加密类型的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是Laravel的新手,只是想知道默认情况下Laravel中的密码使用哪种加密类型.如果要更改db中的密码,那么如何识别密码的加密类型.

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.

先谢谢了. :)

推荐答案

根据 Laravel文档 :

Laravel Hash外观提供安全的Bcrypt哈希存储 用户密码.如果您使用的是AuthController控制器, 包含在您的Laravel应用程序中,它将得到照顾 根据提供的未隐藏版本验证Bcrypt密码 由用户.

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.

同样,Laravel附带的用户注册器服务使 正确的bcrypt函数调用,以哈希存储的密码.

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

使用Bcrypt哈希密码

Hashing A Password Using Bcrypt

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

您还可以使用bcrypt辅助功能:

You may also use the bcrypt helper function:

$password = bcrypt('secret');

验证哈希密码

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

检查是否需要重新输入密码

Checking If A Password Needs To Be Rehashed

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

这篇关于laravel中密码的默认加密类型的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆