Class PasswordSaltBCrypt
- java.lang.Object
-
- com.helger.security.password.salt.PasswordSaltBCrypt
-
- All Implemented Interfaces:
IPasswordSalt
@Nonnegative @Immutable public final class PasswordSaltBCrypt extends Object implements IPasswordSalt
Implementation ofIPasswordSaltusingBCrypt.gensalt(int).- Author:
- Philip Helger
-
-
Constructor Summary
Constructors Constructor Description PasswordSaltBCrypt()Create a new BCrypt password salt with the default rounds of 10.PasswordSaltBCrypt(int nRounds)Constructor to create a new BCrypt password salt with the provided rounds.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(Object o)intgetSaltByteCount()byte[]getSaltBytes()StringgetSaltString()inthashCode()StringtoString()
-
-
-
Constructor Detail
-
PasswordSaltBCrypt
public PasswordSaltBCrypt()
Create a new BCrypt password salt with the default rounds of 10.
-
PasswordSaltBCrypt
public PasswordSaltBCrypt(@Nonnegative int nRounds)
Constructor to create a new BCrypt password salt with the provided rounds.- Parameters:
nRounds- the log2 of the number of rounds of hashing to apply - the work factor therefore increases as 2**log_rounds.
-
-
Method Detail
-
getSaltByteCount
@Nonnegative public int getSaltByteCount()
- Specified by:
getSaltByteCountin interfaceIPasswordSalt- Returns:
- The number of salt bytes used. Always > 0.
-
getSaltBytes
@Nonnull @Nonempty @ReturnsMutableCopy public byte[] getSaltBytes()
- Specified by:
getSaltBytesin interfaceIPasswordSalt- Returns:
- A copy of the pure salt bytes. Never
nullnor empty.
-
getSaltString
@Nonnull @Nonempty public String getSaltString()
- Specified by:
getSaltStringin interfaceIPasswordSalt- Returns:
- The salt bytes in a string representation for easy serialization.
Never
nullnor empty.
-
-