public class CacheUtility
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
CHARACTER_ENCODING
The character encoding that will be used when caching content bytes
|
static java.lang.String |
HASHING_ALGORITHM
The hashing algorithm.
|
static int |
NUMBER_CONVERSION_RADIX
The radix used for converting numbers to an output string value
|
Modifier and Type | Method and Description |
---|---|
static java.math.BigInteger |
hash(byte[] inputBytes,
java.lang.String hashAlgorithm)
Returns a hashed number for the input bytes, using a specified hash algorithm.
|
static java.lang.String |
hashAsString(byte[] inputBytes)
Returns a hashed string of the input bytes
|
static java.lang.String |
hashAsString(byte[] inputBytes,
java.lang.String hashAlgorithm)
Returns a hashed string of the input bytes using a specified hash algorithm.
|
static java.lang.String |
hashString(java.lang.String content)
Hashes the string
|
public static final java.lang.String CHARACTER_ENCODING
public static final java.lang.String HASHING_ALGORITHM
public static final int NUMBER_CONVERSION_RADIX
public static java.lang.String hashString(@NotNull java.lang.String content)
content
- A string to hash, not nullpublic static java.lang.String hashAsString(@NotNull byte[] inputBytes)
inputBytes
- The input bytes to hashpublic static java.lang.String hashAsString(@NotNull byte[] inputBytes, java.lang.String hashAlgorithm) throws java.security.NoSuchAlgorithmException
inputBytes
- The input bytes to hashhashAlgorithm
- The algorithm to use for hashingjava.security.NoSuchAlgorithmException
- If the algorithm specified doesn't existpublic static java.math.BigInteger hash(@NotNull byte[] inputBytes, java.lang.String hashAlgorithm) throws java.security.NoSuchAlgorithmException
inputBytes
- The input bytes to hashhashAlgorithm
- The algorithm to use for hashingjava.security.NoSuchAlgorithmException
- If the algorithm specified doesn't exist