【发布时间】:2015-02-09 22:03:35
【问题描述】:
是否可以使用 Spring Security BCryptPasswordEncoder 为密码添加额外的盐?
【问题讨论】:
标签: spring spring-security salt bcrypt
是否可以使用 Spring Security BCryptPasswordEncoder 为密码添加额外的盐?
【问题讨论】:
标签: spring spring-security salt bcrypt
您不能将 Bcrypt 算法与自定义盐一起使用,因为在 bcrypt algorithm it always chooses a random salt to encode the password and and then finally it attaches the salt to the encoded password. 这是它的工作原理,这就是您不能在此算法中拥有自己的自定义盐的原因。
即使您收到的错误消息也显示相同的内容。如果您想使用自定义盐源进行加密,则应改为使用 SHA-256 或 MD5 算法。
【讨论】: