java.lang.Object
org.omnifaces.utils.security.MessageDigests
-
Method Summary
Modifier and TypeMethodDescriptionstatic byte[]static byte[]static byte[]static byte[]Calculate a message digest over a given string using the specified algorithm.static byte[]static byte[]static MessageDigestgetMessageDigestInstance(String algorithm) Returns aMessageDigestinstance that implements the specified digest algorithm.
-
Method Details
-
getMessageDigestInstance
public static MessageDigest getMessageDigestInstance(String algorithm) throws UncheckedNoSuchAlgorithmException Returns aMessageDigestinstance that implements the specified digest algorithm.This method calls
MessageDigest.getInstance(String), but wraps any potentialNoSuchAlgorithmExceptions in aUncheckedNoSuchAlgorithmExceptionas this is an unrecoverable problem in most cases.- Parameters:
algorithm- the name of the algorithm to use- Returns:
- a
MessageDigestinstance that implements the specified algorithm - Throws:
UncheckedNoSuchAlgorithmException- if no implementation of the given algorithm is found
-
digest
public static byte[] digest(String message, String algorithm) throws UncheckedNoSuchAlgorithmException Calculate a message digest over a given string using the specified algorithm. This method will useUTF_8encoding.- Parameters:
message- the message to calculate the digest overalgorithm- the name of the algorithm- Returns:
- a byte array containing the message digest
- Throws:
UncheckedNoSuchAlgorithmException- if no implementation of the given algorithm could be found
-
digest
public static byte[] digest(String message, Charset charset, String algorithm) throws UncheckedNoSuchAlgorithmException -
digest
public static byte[] digest(String message, byte[] salt, String algorithm) throws UncheckedNoSuchAlgorithmException -
digest
public static byte[] digest(String message, Charset charset, byte[] salt, String algorithm) throws UncheckedNoSuchAlgorithmException -
digest
public static byte[] digest(byte[] message, String algorithm) throws UncheckedNoSuchAlgorithmException -
digest
public static byte[] digest(byte[] message, byte[] salt, String algorithm) throws UncheckedNoSuchAlgorithmException
-