Package ghidra.util
Class MD5Utilities
- java.lang.Object
 - 
- ghidra.util.MD5Utilities
 
 
- 
public class MD5Utilities extends java.lang.Object 
- 
- 
Field Summary
Fields Modifier and Type Field Description static intSALT_LENGTHstatic intSALTED_HASH_LENGTHstatic intUNSALTED_HASH_LENGTH 
- 
Constructor Summary
Constructors Constructor Description MD5Utilities() 
- 
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static char[]getMD5Hash(char[] msg)Generate MD5 hash in a hex character representationstatic java.lang.StringgetMD5Hash(java.io.File file)Generate MD5 message digest hash for specified file contents.static java.lang.StringgetMD5Hash(java.io.InputStream in)Generate MD5 message digest hash for specified input stream.static java.lang.StringgetMD5Hash(java.util.List<java.lang.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 Detail
- 
SALT_LENGTH
public static final int SALT_LENGTH
- See Also:
 - Constant Field Values
 
 
- 
UNSALTED_HASH_LENGTH
public static final int UNSALTED_HASH_LENGTH
- See Also:
 - Constant Field Values
 
 
- 
SALTED_HASH_LENGTH
public static final int SALTED_HASH_LENGTH
- See Also:
 - Constant Field Values
 
 
 - 
 
- 
Method Detail
- 
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
public static java.lang.String getMD5Hash(java.io.InputStream in) throws java.io.IOExceptionGenerate 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:
 java.io.IOException- if reading input stream produces an error
 
- 
getMD5Hash
public static java.lang.String getMD5Hash(java.io.File file) throws java.io.IOExceptionGenerate MD5 message digest hash for specified file contents.- Parameters:
 file- file to be read- Returns:
 - message digest hash
 - Throws:
 java.io.IOException- if opening or reading file produces an error
 
- 
getMD5Hash
public static java.lang.String getMD5Hash(java.util.List<java.lang.String> values)
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
 
 
 - 
 
 -