Class HashUtil

java.lang.Object
com.mirth.connect.server.userutil.HashUtil

public class HashUtil extends Object
Provides hash utility methods.
  • Method Details

    • generate

      public static String generate(Object data) throws Exception
      Takes in any object and generates a SHA-256 hex hash.
      Parameters:
      data - The data to hash.
      Returns:
      hash The generated SHA-256 hex hash of the data.
      Throws:
      Exception - If generating a SHA-256 hex hash fails.
    • generate

      public static String generate(String str, String encoding, String algorithm) throws Exception
      Takes in a string, an encoding, and a hashing algorithm and generates a hex hash.
      Parameters:
      str - The string to hash.
      encoding - The character encoding to use.
      algorithm - The hashing algorithm to use.
      Returns:
      hash The generated hex hash of the string.
      Throws:
      Exception - If generating a hex hash of the string fails.
    • generate

      public static String generate(byte[] bytes, String algorithm) throws Exception
      Takes in a byte[], an encoding, and a hashing algorithm and generates a hex hash.
      Parameters:
      bytes - The byte[] to hash.
      algorithm - The hashing algorithm to use.
      Returns:
      hash The generated hex hash of the byte[].
      Throws:
      Exception - If generating a hex hash of the byte[] fails.