Spring 5 Security 是否支持 $2y$ bcrypt 哈希版本?

Tit*_*lum 2 java spring spring-security bcrypt jbcrypt

我搜索了 Spring 5 Security 的文档,但在$2y$任何地方都找不到对 BCrypt版本前缀的引用。

但是,在查看源代码时,我在以下的Javadoc 中PasswordEncoder找到了一个参考:

可以选择提供“版本”($2a、$2b、$2y)

谁能给我一些共识?$2y$使用 Spring 5 Security 时是否可以使用bcrypt 版本前缀?

Mar*_*ark 5

这取决于您使用的版本,此功能引入的提交是在 2018 年 10 月 18 日。它具有标签5.2.0.M1,表示将引入此提交的版本,该版本的官方文档现在指定此功能存在

使用 BCrypt 强散列函数的 PasswordEncoder 的实现。客户端可以选择提供“版本”($2a、$2b、$2y)和“强度”(也就是 BCrypt 中的日志轮次)和 SecureRandom 实例。强度参数越大,需要做更多的工作(以指数方式)来散列密码。默认值为 10。

Before version 5.2.0.M1 this feature did not exist, there's no official release yet of this version, only snapshots (5.2.0.M1 was released on Jan 16, 2019).

This version (or newer) is what you'll have to use if you want to use this feature, until an official release is made.