【发布时间】:2014-06-24 15:58:15
【问题描述】:
我有一个关于在 spring security 中实现 bcrypt 的问题。类“org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder” 在 bcrypt 的第一个构造函数中,我看到“this(-1);”这到底是什么意思。据我了解,这应该指“强度”字段,默认值应该是 org.springframework.security.crypto.bcrypt.BCrypt “private static final int GENSALT_DEFAULT_LOG2_ROUNDS = 10;”中设置的 10,但那是什么 - 1 指,第一个构造函数?
public class BCryptPasswordEncoder implements PasswordEncoder {
private Pattern BCRYPT_PATTERN = Pattern.compile("\\A\\$2a?\\$\\d\\d\\$[./0-9A-Za-z]{53}");
private final Log logger = LogFactory.getLog(getClass());
private final int strength;
private final SecureRandom random;
public BCryptPasswordEncoder() {
this(-1);
}
【问题讨论】:
标签: constructor spring-security bcrypt