gpt4 book ai didi

php - laravel 密码盐存储在哪里?

转载 作者:行者123 更新时间:2023-12-03 00:04:43 26 4
gpt4 key购买 nike

Laravel 使用 bcrypt 来哈希密码。

根据本文,在该过程中的某个时刻,Hash::make 函数创建并使用 22 长度的随机字符串作为盐来生成密码。

对于单个不同的密码,Hash::make 确实返回唯一的哈希值,暗示它确实在过程中的某个地方使用了某种加盐。

但是这些盐没有存储在我期望的用户表中。 Laravel 如何知道用于验证密码的适当哈希值?

Laravel Hash Explained

最佳答案

您链接的文章似乎包含答案。 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.

关于php - laravel 密码盐存储在哪里?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32030933/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com