Package ghidra.util

Class MD5Utilities

java.lang.Object
ghidra.util.MD5Utilities

public class MD5Utilities extends Object
  • Field Details

  • 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

      public static String getMD5Hash(InputStream in) throws IOException
      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

      public static String getMD5Hash(File file) throws IOException
      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

      public static String getMD5Hash(List<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