Package ghidra.util
Class MD5Utilities
java.lang.Object
ghidra.util.MD5Utilities
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intstatic final intstatic final int -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic char[]getMD5Hash(char[] msg) Generate MD5 hash in a hex character representationstatic StringgetMD5Hash(File file) Generate MD5 message digest hash for specified file contents.static StringGenerate MD5 message digest hash for specified input stream.static StringgetMD5Hash(List<String> values) Generate combined MD5 message digest hash for all values in the specified values list.static char[]getSaltedMD5Hash(char[] msg) Generate salted MD5 hash for specified message using random salt.static char[]getSaltedMD5Hash(char[] salt, char[] msg) Generate salted MD5 hash for specified message.static char[]hexDump(byte[] data) Convert binary data to a sequence of hex characters.
-
Field Details
-
SALT_LENGTH
public static final int SALT_LENGTH- See Also:
-
UNSALTED_HASH_LENGTH
public static final int UNSALTED_HASH_LENGTH- See Also:
-
SALTED_HASH_LENGTH
public static final int SALTED_HASH_LENGTH- See Also:
-
-
Constructor Details
-
MD5Utilities
public MD5Utilities()
-
-
Method Details
-
getMD5Hash
public static char[] getMD5Hash(char[] msg) Generate MD5 hash in a hex character representation- Parameters:
msg- message text- Returns:
- hex hash value in text format
-
getSaltedMD5Hash
public static char[] getSaltedMD5Hash(char[] salt, char[] msg) Generate salted MD5 hash for specified message. Supplied salt is returned as prefix to returned hash.- Parameters:
salt- digest salt (use empty string for no salt)msg- message text- Returns:
- salted hash using specified salt which is returned as a prefix to the hash
-
getSaltedMD5Hash
public static char[] getSaltedMD5Hash(char[] msg) Generate salted MD5 hash for specified message using random salt. First 4-characters of returned hash correspond to the salt data.- Parameters:
msg- message text- Returns:
- salted hash using randomly generated salt which is returned as a prefix to the hash
-
getMD5Hash
Generate MD5 message digest hash for specified input stream. Stream will be read until EOF is reached.- Parameters:
in- input stream- Returns:
- message digest hash
- Throws:
IOException- if reading input stream produces an error
-
getMD5Hash
Generate MD5 message digest hash for specified file contents.- Parameters:
file- file to be read- Returns:
- message digest hash
- Throws:
IOException- if opening or reading file produces an error
-
getMD5Hash
Generate combined MD5 message digest hash for all values in the specified values list.- Parameters:
values- list of text strings- Returns:
- MD5 message digest hash
-
hexDump
public static char[] hexDump(byte[] data) Convert binary data to a sequence of hex characters.- Parameters:
data- binary data- Returns:
- hex character representation of data
-