public final class HashUtil
extends java.lang.Object
MessageDigests and Files.| Modifier and Type | Method and Description |
|---|---|
static java.lang.String |
getFileHash(java.io.File file,
java.lang.String algorithm)
Gets the hash of the provided file
|
static java.lang.String |
getHash(java.security.MessageDigest digest)
Gets the hash from the provided
MessageDigest. |
public static java.lang.String getFileHash(java.io.File file,
java.lang.String algorithm)
throws java.security.NoSuchAlgorithmException,
java.io.IOException
file - the filealgorithm - the hashing algorithm (used on MessageDigest.getInstance(String))java.security.NoSuchAlgorithmException - if the provided algorithm couldn't be foundjava.io.IOException - if reading the file was unsuccessfulpublic static java.lang.String getHash(java.security.MessageDigest digest)
MessageDigest.digest - the message digest