mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2026-09-19 16:40:38 -09:00
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:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user