Class MD5Util


  • public class MD5Util
    extends java.lang.Object
    Contains utility methods that use MD5 hashing. The class uses STANDARD JVM MD5 algorithm.
    • Constructor Summary

      Constructors 
      Constructor Description
      MD5Util()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.lang.String calculateMd5​(java.lang.String input)
      Calculates MD5 hash for string.
      static java.lang.String calculateMd5​(java.lang.String input, java.lang.String encoding)
      Calculates MD5 hash for string.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

    • Method Detail

      • calculateMd5

        public static java.lang.String calculateMd5​(java.lang.String input)
                                             throws java.security.NoSuchAlgorithmException
        Calculates MD5 hash for string. assume string is UTF-8 encoded
        Parameters:
        input - string which is going to be encoded into MD5 format
        Returns:
        MD5 representation of the input string
        Throws:
        java.security.NoSuchAlgorithmException - if the MD5 algorithm is not available.
      • calculateMd5

        public static java.lang.String calculateMd5​(java.lang.String input,
                                                    java.lang.String encoding)
                                             throws java.security.NoSuchAlgorithmException,
                                                    java.io.UnsupportedEncodingException
        Calculates MD5 hash for string.
        Parameters:
        input - string which is going to be encoded into MD5 format
        encoding - character encoding of the string which is going to be encoded into MD5 format
        Returns:
        MD5 representation of the input string
        Throws:
        java.security.NoSuchAlgorithmException - if the MD5 algorithm is not available.
        java.io.UnsupportedEncodingException - if the specified encoding is unavailable.