GP-907 Add getByteProvider(GFile) to some file systems.

This commit adds getByteProvider(GFile) to a first batch of filesystems.  Remaining filesystems will be addressed in future commits.
This commit is contained in:
dev747368
2021-04-30 13:05:35 -04:00
parent f91ba90fe8
commit 3c73f252cb
15 changed files with 403 additions and 202 deletions

View File

@@ -170,6 +170,21 @@ public class HashUtilities {
return NumericUtilities.convertBytesToString(messageDigest.digest());
}
/**
* Generate combined message digest hash for the bytes in the specified array.
*
* @param algorithm message digest algorithm
* @param values array of bytes to hash
* @return message digest hash
* @throws IllegalArgumentException if specified algorithm is not supported
* @see MessageDigest for supported hash algorithms
*/
public static String getHash(String algorithm, byte[] values) {
MessageDigest messageDigest = getMessageDigest(algorithm);
messageDigest.update(values);
return NumericUtilities.convertBytesToString(messageDigest.digest());
}
private static MessageDigest getMessageDigest(String algorithm) {
try {
return MessageDigest.getInstance(algorithm);