public class SaltedHash extends Object
Constructor and Description |
---|
SaltedHash(byte[] hash,
byte[] salt)
Creates a new instance with digest and salt data.
|
SaltedHash(byte[] hashWithSalt,
int digestLength,
boolean toEnd)
Creates a new instance from byte input that contains the concatenation of digest output and salt.
|
Modifier and Type | Method and Description |
---|---|
byte[] |
concatenateSalt(boolean toEnd)
Gets a byte array containing the concatenation of digest output and salt.
|
String |
concatenateSalt(boolean toEnd,
Encoder encoder)
Gets an encoded string of the concatenation of digest output and salt.
|
byte[] |
getHash() |
byte[] |
getSalt() |
byte[] |
getSalt(int n)
Gets N bytes of salt.
|
public SaltedHash(byte[] hash, byte[] salt)
hash
- Digest output.salt
- Salt value used to compute salt.public SaltedHash(byte[] hashWithSalt, int digestLength, boolean toEnd)
hashWithSalt
- Concatenation of hash and salt.digestLength
- Number of bytes in digest output.toEnd
- True if salt is appended to end of hash, false if salt is prepended to hash.public byte[] getHash()
public byte[] getSalt()
public byte[] getSalt(int n)
n
- Number of bytes of salt; must be less than or equal to salt size.public String concatenateSalt(boolean toEnd, Encoder encoder)
toEnd
- True to append salt to end of hash, false to prefix hash with salt.encoder
- Encodes concatenated bytes to a string.public byte[] concatenateSalt(boolean toEnd)
toEnd
- True to append salt to end of hash, false to prefix hash with salt.Copyright © 2003-2024 Virginia Tech. All Rights Reserved.