Spring Security bcrypt constructor -
Spring Security bcrypt constructor -
i have question implementation of bcrypt in spring security.the class "org.springframework.security.crypto.bcrypt.bcryptpasswordencoder" in first constructor of bcrypt see "this(-1);" mean. far understand should refer field "strength" , default value should 10 set in org.springframework.security.crypto.bcrypt.bcrypt "private static final int gensalt_default_log2_rounds = 10;", -1 referring to, first constructor?
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); }
since got far, why not @ where it's used in remainder of file?
unless value greater zero, calls default jbcrypt gensalt
function:
bcrypt.gensalt();
which in turn uses default strength setting.
constructor spring-security bcrypt
Comments
Post a Comment