public class Hasher extends Object
| 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,
HashAlgorithm hashAlgorithm,
Charset charset)
Hash.
|
static String |
hashAndBase64(String hashIt,
String salt,
HashAlgorithm hashAlgorithm,
Charset charset) |
static String |
hashAndHex(String hashIt,
String salt,
HashAlgorithm hashAlgorithm,
Charset charset)
Hash and hex.
|
public static byte[] getRandomSalt(int length,
Charset charset)
length - the lengthcharset - the charsetpublic static String hash(String hashIt, String salt, HashAlgorithm hashAlgorithm, Charset charset) throws NoSuchAlgorithmException
hashIt - the hash itsalt - the salthashAlgorithm - the hash algorithmcharset - the charsetNoSuchAlgorithmException - is thrown if instantiation of the MessageDigest object fails.public static String hashAndBase64(String hashIt, String salt, HashAlgorithm hashAlgorithm, Charset charset) throws NoSuchAlgorithmException
NoSuchAlgorithmExceptionpublic static String hashAndHex(String hashIt, String salt, HashAlgorithm hashAlgorithm, Charset charset) throws NoSuchAlgorithmException, InvalidKeyException, UnsupportedEncodingException, NoSuchPaddingException, IllegalBlockSizeException, BadPaddingException
hashIt - the hash itsalt - the salthashAlgorithm - the hash algorithmcharset - the charsetNoSuchAlgorithmException - 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.Copyright © 2015–2016 Alpha Ro Group UG (haftungsbeschrÀngt). All rights reserved.