Class DigestUtil

java.lang.Object
net.targetr.wtm3.io.DigestUtil

public class DigestUtil extends Object
Tools for processing hashes.
Author:
Dr Michael Gardiner
  • Constructor Details

    • DigestUtil

      public DigestUtil()
  • Method Details

    • md5

      public static String md5(byte[] data)
      Generates a text MD5 from an array of bytes.
      Parameters:
      data - source data to create MD5 from.
      Returns:
      the string MD5 of data.
    • md5Bytes

      public static byte[] md5Bytes(byte[] data)
      Generates a byte array MD5 from an array of bytes.
      Parameters:
      data - source data to create MD5 from.
      Returns:
      the byte array MD5 of data.
    • bytesToHex

      public static String bytesToHex(byte[] bytes)
      Converts a byte array to a text string of HEX.
      Parameters:
      bytes - to convert to HEX.
      Returns:
      the string HEX version of the bytes.
    • hexStringToByteArray

      public static byte[] hexStringToByteArray(String hex)
      Converts string of hex into byte array.
      Parameters:
      hex - the HEX string to convert.
      Returns:
      byte array created from HEX.