public final class HashHelper extends Object
| Modifier and Type | Method and Description |
|---|---|
static void |
addSalt(Hash hash,
byte[] storedSalt,
byte[] fixedSalt,
SaltOrder saltOrder)
Add the specified salt to the specified hash in the specified order.
|
static byte[] |
addSaltBytes(byte[] hash,
byte[] salt,
SaltStoreType saltStoreType)
Store the salt bytes in the result array of bytes along with the hash bytes.
|
static Hash |
getHash(byte[] bytes,
String algorithm)
Create the hash object for the specified bytes.
|
static Hash |
getHash(CharSequence charSequence,
String algorithm)
Create the hash object for the specified char sequence.
|
static Hash |
getHash(CharSequence charSequence,
String encoding,
String algorithm)
Create the hash object for the specified char sequence.
|
static Hash |
getHash(InputStream stream,
String algorithm)
Create the hash object for the specified stream of bytes.
|
static byte[] |
getHashBytes(byte[] bytes,
SaltStoreType saltStoreType,
int saltLength)
Get the hash bytes from the the array of bytes.
|
static byte[] |
getSaltBytes(byte[] bytes,
SaltStoreType saltStoreType,
int saltLength)
Get the salt bytes from the the array of bytes.
|
public static Hash getHash(byte[] bytes, String algorithm)
bytes - the specified bytes.algorithm - the hash algorithm.public static Hash getHash(CharSequence charSequence, String algorithm)
charSequence - the specified char sequence.algorithm - the hash algorithm.public static Hash getHash(CharSequence charSequence, String encoding, String algorithm)
charSequence - the specified char sequence.encoding - the encoding of the char sequence.algorithm - the hash algorithm.public static Hash getHash(InputStream stream, String algorithm)
stream - the specified stream of bytes.algorithm - the hash algorithm.public static void addSalt(Hash hash, byte[] storedSalt, byte[] fixedSalt, SaltOrder saltOrder)
hash - the hash object.storedSalt - the stored salt.fixedSalt - the fixed salt.saltOrder - the stored salt and the fixed salt order.public static byte[] addSaltBytes(byte[] hash,
byte[] salt,
SaltStoreType saltStoreType)
hash - the hash bytes.salt - the salt bytes.saltStoreType - how to store the salt bytes.public static byte[] getHashBytes(byte[] bytes,
SaltStoreType saltStoreType,
int saltLength)
bytes - the array of bytes.saltStoreType - how the salt bytes are stored.saltLength - the number of the salt bytes.public static byte[] getSaltBytes(byte[] bytes,
SaltStoreType saltStoreType,
int saltLength)
bytes - the array of bytes.saltStoreType - how the salt bytes are stored.saltLength - the number of the salt bytes.Copyright © 2017. All rights reserved.