@Nonnegative @Immutable public final class PasswordSalt extends Object implements IPasswordSalt
IPasswordSalt using
VerySecureRandom.| Modifier and Type | Field and Description |
|---|---|
static int |
DEFAULT_SALT_BYTES
Default salt byte length is nothing else is specified.
|
| Constructor and Description |
|---|
PasswordSalt()
Deprecated.
Since 10.1.4. Use
createRandom() instead |
PasswordSalt(byte[] aBytes)
Constructor with salt bytes.
|
PasswordSalt(int nSaltBytes)
Deprecated.
Since 10.1.4. Use
createRandom(int) instead |
| Modifier and Type | Method and Description |
|---|---|
static PasswordSalt |
createFromStringMaybe(String sSalt)
Try to create a
PasswordSalt object from the passed string. |
static PasswordSalt |
createRandom() |
static PasswordSalt |
createRandom(int nSaltBytes)
Create a new password salt with the provided byte count.
|
boolean |
equals(Object o) |
int |
getSaltByteCount() |
byte[] |
getSaltBytes() |
String |
getSaltString() |
int |
hashCode() |
String |
toString() |
public static final int DEFAULT_SALT_BYTES
@Deprecated public PasswordSalt()
createRandom() instead@Deprecated public PasswordSalt(@Nonnegative int nSaltBytes)
createRandom(int) insteadnSaltBytes - The number of salt bytes to use. Must be > 0.public PasswordSalt(@Nonnull @Nonempty byte[] aBytes)
aBytes - Salt bytes to use. May not be null or empty.@Nonnegative public int getSaltByteCount()
getSaltByteCount in interface IPasswordSalt@Nonnull @Nonempty @ReturnsMutableCopy public byte[] getSaltBytes()
getSaltBytes in interface IPasswordSaltnull nor empty.@Nonnull @Nonempty public String getSaltString()
getSaltString in interface IPasswordSaltnull nor empty.@Nonnull public static PasswordSalt createRandom()
@Nonnull public static PasswordSalt createRandom(@Nonnegative int nSaltBytes)
nSaltBytes - The number of salt bytes to use. Must be > 0.@Nullable public static PasswordSalt createFromStringMaybe(@Nullable String sSalt)
PasswordSalt object from the passed string. First
the string is hex decoded into a byte array and this is the password salt.sSalt - The string to be used. May be null.null if the passed salt string is null or
empty.IllegalArgumentException - if the passed salt string cannot be hex decoded.Copyright © 2016–2021 Philip Helger. All rights reserved.