Class EncodeUtil


  • public class EncodeUtil
    extends Object
    Util class for encoding
    Since:
    1.0.0
    Author:
    balazs.joo, Imre Scheffer
    • Constructor Detail

      • EncodeUtil

        public EncodeUtil()
        Default constructor, constructs a new object.
    • Method Detail

      • Sha512

        @Deprecated(forRemoval=true,
                    since="2.5.0")
        public static String Sha512​(String str)
        Deprecated, for removal: This API element is subject to removal in a future version.
        use sha_512(String) instead
        Encodes input String with SHA-512.
        Parameters:
        str - input String
        Returns:
        encoded String or null if invalid input or encoding error
      • sha_512

        public static String sha_512​(String stringInput)
                              throws hu.icellmobilsoft.coffee.dto.exception.BaseException
        Digest message input String with SHA-512.
        Parameters:
        stringInput - input String
        Returns:
        Upper case encoded String or null if invalid input or encoding error
        Throws:
        hu.icellmobilsoft.coffee.dto.exception.BaseException - any exception
        Since:
        2.5.0
      • sha3_512

        public static String sha3_512​(String stringInput)
                               throws hu.icellmobilsoft.coffee.dto.exception.BaseException
        Digest message input String with SHA3-512.
        Parameters:
        stringInput - input String
        Returns:
        Upper case encoded String or null if invalid input or encoding error
        Throws:
        hu.icellmobilsoft.coffee.dto.exception.BaseException - any exception
        Since:
        2.5.0
      • messageDigest

        public static String messageDigest​(byte[] input,
                                           String algorithm)
                                    throws hu.icellmobilsoft.coffee.dto.exception.BaseException
        Encodes input String with specified algorithm.
        Parameters:
        input - input message to digest
        algorithm - one of message digest algorithms
        Returns:
        message digest output by algorith
        Throws:
        hu.icellmobilsoft.coffee.dto.exception.BaseException - any exception
        Since:
        2.5.0
      • byteToHex

        public static String byteToHex​(byte[] hash)
        Format input byte[] to HEX String
        Parameters:
        hash - byte array
        Returns:
        HEX String