| Constructor and Description |
|---|
Hasher() |
| Modifier and Type | Method and Description |
|---|---|
static byte[] |
getRandomSalt(int length,
Charset charset)
Gets the random salt.
|
static String |
hash(String hashIt,
String salt,
de.alpharogroup.crypto.algorithm.HashAlgorithm hashAlgorithm,
Charset charset)
Hashes the given
String object with the given parameters. |
static String |
hashAndBase64(String hashIt,
String salt,
de.alpharogroup.crypto.algorithm.HashAlgorithm hashAlgorithm,
Charset charset)
Hashes and encodes it with base64 from the given
String object with the given
parameters. |
static String |
hashAndHex(String hashIt,
String salt,
de.alpharogroup.crypto.algorithm.HashAlgorithm hashAlgorithm,
Charset charset)
Hashes and hex it with the given
String object with the given parameters. |
public static byte[] getRandomSalt(int length,
Charset charset)
length - the lengthcharset - the charsetpublic static String hash(String hashIt, String salt, de.alpharogroup.crypto.algorithm.HashAlgorithm hashAlgorithm, Charset charset) throws NoSuchAlgorithmException
String object with the given parameters.hashIt - the hash itsalt - the salthashAlgorithm - the hash algorithmcharset - the charsetString objectNoSuchAlgorithmException - is thrown if instantiation of the MessageDigest object fails.public static String hashAndBase64(String hashIt, String salt, de.alpharogroup.crypto.algorithm.HashAlgorithm hashAlgorithm, Charset charset) throws NoSuchAlgorithmException
String object with the given
parameters.hashIt - the hash itsalt - the salthashAlgorithm - the hash algorithmcharset - the charsetString objectNoSuchAlgorithmException - is thrown if instantiation of the MessageDigest object fails.public static String hashAndHex(String hashIt, String salt, de.alpharogroup.crypto.algorithm.HashAlgorithm hashAlgorithm, Charset charset) throws NoSuchAlgorithmException, InvalidKeyException, UnsupportedEncodingException, NoSuchPaddingException, IllegalBlockSizeException, BadPaddingException, InvalidKeySpecException, InvalidAlgorithmParameterException
String object with the given parameters.hashIt - the hash itsalt - the salthashAlgorithm - the hash algorithmcharset - the charsetString objectNoSuchAlgorithmException - is thrown if instantiation of the MessageDigest object fails.UnsupportedEncodingException - is thrown by get the byte array of the private key String object fails.NoSuchPaddingException - is thrown if instantiation of the cypher object fails.InvalidKeyException - the invalid key exception is thrown if initialization of the cypher object fails.BadPaddingException - is thrown if Cipher.doFinal(byte[]) fails.IllegalBlockSizeException - is thrown if Cipher.doFinal(byte[]) fails.InvalidAlgorithmParameterException - is thrown if initialization of the cypher object fails.InvalidKeySpecException - is thrown if generation of the SecretKey object fails.Copyright © 2015–2017 Alpha Ro Group UG (haftungsbeschrÀngt). All rights reserved.