Laravel 5.5 的 BCrypt对密码进行加密及密码验证

一、加密

方法1)

$password= Hash::make('密码');

 

方法2)

/也可直接使用 bcrypt 的 function

$password= bcrypt('密码');

 

二、密码验证

$hashedPassword  为数据库中保存的密码值

if(Hash::check('用户输入的密码',$hashedPassword))

{

    密码正确逻辑

}else{

    密码不正确逻辑

}

 

本博客地址: wukong1688

本文原文地址:https://www.cnblogs.com/wukong1688/p/10947411.html

转载请著名出处!谢谢~~

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-08-28
  • 2022-12-23
  • 2021-12-31
  • 2021-06-04
  • 2021-11-21
  • 2022-12-23
猜你喜欢
  • 2021-08-25
  • 2022-02-25
  • 2022-12-23
  • 2022-01-26
  • 2021-08-23
  • 2021-12-15
相关资源
相似解决方案