Class SHA256Util
java.lang.Object
org.opencastproject.urlsigning.utils.SHA256Util
A utility class to hash plain text with the SHA-256 algorithm.
-
Method Summary
-
Method Details
-
digest
public static String digest(String plainText, String secretKey) throws NoSuchAlgorithmException, InvalidKeyException, UnsupportedEncodingException Create a SHA 256 digest string from a string and a secret key.- Parameters:
plainText- The plaintext string to hash.secretKey- The key to use to create the hash.- Returns:
- Returns a hash of the plain text hashed with the secret key.
- Throws:
NoSuchAlgorithmException- Thrown if the algorithm is not supported on this platform.InvalidKeyException- Thrown if the secret key is invalid.UnsupportedEncodingException- Thrown if unable to convert bytes into a hex string.
-