Class HashUtils


  • public class HashUtils
    extends Object
    Utility hash functions
    • Constructor Detail

      • HashUtils

        public HashUtils()
    • Method Detail

      • md5

        public static String md5​(String source)
        Takes a string and returns the HEX representation of the MD5 sum for the given string.
        Parameters:
        source - the string
        Returns:
        md5 hex string
      • decodeHex

        public static byte[] decodeHex​(char[] data)
        Converts an array of character bytes representing hexadecimal values into an array of bytes of those same values. The returned array will be half the length of the passed array, as it takes two characters to represent any given byte. An exception is thrown if the passed char array has an odd number of elements.
        Parameters:
        data - array of input data containing hex characters
        Returns:
        byte array containing teh binary data decoded from the given input data