类 HashUtil

java.lang.Object
cn.vorbote.core.utils.HashUtil

public final class HashUtil extends Object
HashUtil can help you hash arbitrary strings.
作者:
vorbote
  • 方法详细资料

    • encrypt

      public static String encrypt(Hash 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
      抛出:
      UnsupportedHashAlgorithmException - If the param method used an item which is not listed on the list above, the exception will be thrown.
      另请参阅:
    • 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(Hash 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

      public static String decrypt(Hash method, String key, String data)
      This method can decrypt an 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(Hash 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(Hash method, String key, String data)
      Encrypt a string to a HexString
      参数:
      method - The specified method.
      data - The origin data.
      key - The key.
      返回:
      The encrypted string.