类 HashUtil


  • public final class HashUtil
    extends Object
    This tool class can convert String to different types of results.
    作者:
    TheodoreHills
    • 方法详细资料

      • Encrypt

        public static String Encrypt​(EncryptMethod method,
                                     String value)
        Encrypt the string via specified encrypt method. All supported method:
        • MD2
        • MD5
        • SHA-1
        • SHA-224
        • SHA-384
        • SHA-512
        参数:
        method - Encrypt method.
        value - The string will be encrypted
        返回:
        The encrypted String
      • Base64Encode

        public static String Base64Encode​(String value)
        Encrypt the string via Base64
        参数:
        value - The string will be encrypted
        返回:
        The encrypted String
      • Base64Decode

        public static String Base64Decode​(String value)
        Decode the string via Base64
        参数:
        value - The string will be encrypted
        返回:
        The encrypted String
      • Decrypt

        public static String Decrypt​(EncryptMethod method,
                                     String key,
                                     byte[] data)
        This method can decrypt a encrypted String(in byte mode).
        参数:
        method - The decrypt method type.
        key - The key to decrypt the String.
        data - The encrypted String.
        返回:
        The original string.
        另请参阅:
        Decrypt(EncryptMethod, String, String)
      • Decrypt

        public static String Decrypt​(EncryptMethod method,
                                     String key,
                                     String data)
        This method can decrypt a encrypted String(in byte mode).
        参数:
        method - The decrypt method type.
        key - The key to decrypt the String.
        data - The encrypted String.
        返回:
        The original string.
      • EncryptToByteStream

        public static byte[] EncryptToByteStream​(EncryptMethod method,
                                                 String data,
                                                 String key)
        Encrypt the data through a key.
        参数:
        method - The method to encrypt the data.
        data - The data will be encrypt to rc4 string.
        key - The key to encrypt the string.
        返回:
        The encrypted String by stream.
      • Encrypt

        public static String Encrypt​(EncryptMethod method,
                                     String data,
                                     String key)
        Encrypt a string to a HexString
        参数:
        method - The specified method.
        data - The origin data.
        key - The key.
        返回:
        The encrypted string.