Where are laravel password salts stored?(laravel 密码盐存储在哪里?)
问题描述
Laravel 使用 bcrypt
对密码进行哈希处理.
Laravel uses bcrypt
to hash passwords.
根据这篇文章,在过程中的某个时刻,Hash::make
函数创建并使用一个 22 长度的随机字符串作为盐来生成密码.
According to this article, at some point in the process, the Hash::make
function creates and uses a 22-length random string as a salt to generate the password.
对于单个不同的密码,Hash::make
确实返回唯一的哈希值,暗示它确实在过程中的某处使用了某种盐渍.
For a single distinct password, Hash::make
does return unique hashes, hinting that it does use some kind of salting somewhere in the process.
但是这些盐没有存储在用户表中,我期望它们.laravel 如何知道用于验证密码的适当哈希值?
But these salts are not stored in the users table, where I would expect them. How does laravel know the appropriate hash to use to verify the password?
Laravel 哈希解释
推荐答案
您链接的文章似乎包含答案.https://mnshankar.wordpress.com/2014/03/29/laravel-hash-make-explained/
The article that you linked seems to contain the answer. https://mnshankar.wordpress.com/2014/03/29/laravel-hash-make-explained/
这样做的聪明之处在于算法、盐和成本是嵌入到哈希中,因此可以很容易地解析成用于重建/验证的单个组件(请参阅php crypt 源代码的相关部分位于https://github.com/php/php-src/blob/master/ext/standard/crypt.c#L258).因此,您无需将盐/成本单独存储在数据库表.
The cleverness of this is that the algorithm, salt and cost are embedded into the hash and so can be easily parsed out into individual components for reconstruction/verification (Please see relevant sections of the php crypt source code at https://github.com/php/php-src/blob/master/ext/standard/crypt.c#L258). Because of this, you don’t need to store the salt/cost separately in a database table.
这篇关于laravel 密码盐存储在哪里?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:laravel 密码盐存储在哪里?
基础教程推荐
- 在多维数组中查找最大值 2021-01-01
- XAMPP 服务器不加载 CSS 文件 2022-01-01
- 如何在 PHP 中的请求之间持久化对象 2022-01-01
- mysqli_insert_id 是否有可能在高流量应用程序中返回 2021-01-01
- 超薄框架REST服务两次获得输出 2022-01-01
- Libpuzzle 索引数百万张图片? 2022-01-01
- 在 Woocommerce 中根据运输方式和付款方式添加费用 2021-01-01
- WooCommerce 中选定产品类别的自定义产品价格后缀 2021-01-01
- 通过 PHP SoapClient 请求发送原始 XML 2021-01-01
- 在 PHP 中强制下载文件 - 在 Joomla 框架内 2022-01-01