laravel 密码盐存储在哪里?
Where are laravel password salts stored?
Laravel 使用 bcrypt
散列密码。
根据这篇文章,在这个过程中的某个时刻,Hash::make
函数创建并使用一个 22 长度的随机字符串作为盐来生成密码。
对于单个不同的密码,Hash::make
会执行 return 唯一的哈希,暗示它确实在过程中的某处使用了某种加盐。
但是这些盐并没有存储在用户 table 中,我希望它们存在。 laravel 如何知道用于验证密码的适当散列?
您链接的文章似乎包含答案。
https://mnshankar.wordpress.com/2014/03/29/laravel-hash-make-explained/
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 使用 bcrypt
散列密码。
根据这篇文章,在这个过程中的某个时刻,Hash::make
函数创建并使用一个 22 长度的随机字符串作为盐来生成密码。
对于单个不同的密码,Hash::make
会执行 return 唯一的哈希,暗示它确实在过程中的某处使用了某种加盐。
但是这些盐并没有存储在用户 table 中,我希望它们存在。 laravel 如何知道用于验证密码的适当散列?
您链接的文章似乎包含答案。 https://mnshankar.wordpress.com/2014/03/29/laravel-hash-make-explained/
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.