类 HashUtil

java.lang.Object
cn.vonce.sql.uitls.HashUtil

public class HashUtil extends Object
Utility class for hashing.
作者:
liaoxuefeng
  • 构造器详细资料

    • HashUtil

      public HashUtil()
  • 方法详细资料

    • sha1

      public static String sha1(String input)
      Generate SHA-1 as hex string (all lower-case).
      参数:
      input - Input as string.
      返回:
      Hex string.
    • sha1

      public static String sha1(byte[] input)
      Generate SHA-1 as hex string (all lower-case).
      参数:
      input - Input as bytes.
      返回:
      Hex string.
    • sha1AsBytes

      public static byte[] sha1AsBytes(String input)
    • sha1AsBytes

      public static byte[] sha1AsBytes(byte[] input)
      Generate SHA-1 as bytes.
      参数:
      input - Input as bytes.
      返回:
      Bytes.
    • sha256

      public static String sha256(String input)
      Generate SHA-256 as hex string (all lower-case).
      参数:
      input - Input as String.
      返回:
      Hex string.
    • sha256AsBytes

      public static byte[] sha256AsBytes(String input)
      Generate SHA-256 as hex string (all lower-case).
      参数:
      input - Input as String.
      返回:
      Hex string.
    • sha256

      public static String sha256(byte[] input)
      Generate SHA-256 as hex string (all lower-case).
      参数:
      input - Input as bytes.
      返回:
      Hex string.
    • sha256AsBytes

      public static byte[] sha256AsBytes(byte[] input)
      Generate SHA-256 as bytes.
      参数:
      input - Input as bytes.
      返回:
      SHA bytes.
    • sha512AsBytes

      public static byte[] sha512AsBytes(byte[] input)
      Generate SHA-512 as bytes.
      参数:
      input - Input as bytes.
      返回:
      SHA bytes.
    • hmacSha256AsBytes

      public static byte[] hmacSha256AsBytes(byte[] data, byte[] key)
      Do HMAC-SHA256.
      返回:
      Hex string.
    • hmacSha256

      public static String hmacSha256(byte[] data, byte[] key)
      Do HMAC-SHA256.
      返回:
      Hex string.
    • hmacSha1

      public static byte[] hmacSha1(byte[] data, byte[] key)
      Do HMAC-SHA1.
      返回:
      byte[] as result.
    • hmacSha256

      public static String hmacSha256(String data, String key)
      Do HMAC-SHA256.
      返回:
      byte[] as result.
    • hmacSha256AsBytes

      public static byte[] hmacSha256AsBytes(String data, String key)
      Do HMAC-SHA256.
      返回:
      byte[] as result.
    • hmacSha256

      public static String hmacSha256(byte[] data, String key)
      Do HMAC-SHA256.
      返回:
      byte[] as result.