Class HMac


  • public final class HMac
    extends java.lang.Object
    hmac算法
    Author:
    WD
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static byte[] sha1​(byte[] b)
      使用HMAC-SHA1进行消息签名, 返回字节数组,长度为20字节.
      static byte[] sha1​(byte[] b, java.lang.String key)
      使用HMAC-SHA1进行消息签名, 返回字节数组,长度为20字节.
      static java.lang.String sha1​(java.lang.String text)
      使用HMAC-SHA1进行消息签名, 返回字节数组,长度为20字节.
      static byte[] sha256​(byte[] b)
      使用HMAC-SHA1进行消息签名, 返回字节数组,长度为20字节.
      static java.lang.String sha256​(java.lang.String text)
      使用HMAC-SHA1进行消息签名, 返回字节数组,长度为20字节.
      static byte[] sha384​(byte[] b)
      使用HMAC-SHA1进行消息签名, 返回字节数组,长度为20字节.
      static java.lang.String sha384​(java.lang.String text)
      使用HMAC-SHA1进行消息签名, 返回字节数组,长度为20字节.
      static byte[] sha512​(byte[] b)
      使用HMAC-SHA1进行消息签名, 返回字节数组,长度为20字节.
      static java.lang.String sha512​(java.lang.String text)
      使用HMAC-SHA1进行消息签名, 返回字节数组,长度为20字节.
      • Methods inherited from class java.lang.Object

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

      • sha1

        public static java.lang.String sha1​(java.lang.String text)
        使用HMAC-SHA1进行消息签名, 返回字节数组,长度为20字节.
        Parameters:
        text - 原始输入字符串
        Returns:
        结果
      • sha1

        public static byte[] sha1​(byte[] b)
        使用HMAC-SHA1进行消息签名, 返回字节数组,长度为20字节.
        Parameters:
        b - 原始输入字符串
        Returns:
        结果
      • sha1

        public static byte[] sha1​(byte[] b,
                                  java.lang.String key)
        使用HMAC-SHA1进行消息签名, 返回字节数组,长度为20字节.
        Parameters:
        b - 原始输入字符串
        key - 加密key
        Returns:
        结果
      • sha256

        public static java.lang.String sha256​(java.lang.String text)
        使用HMAC-SHA1进行消息签名, 返回字节数组,长度为20字节.
        Parameters:
        text - 原始输入字符串
        Returns:
        结果
      • sha256

        public static byte[] sha256​(byte[] b)
        使用HMAC-SHA1进行消息签名, 返回字节数组,长度为20字节.
        Parameters:
        b - 原始输入字符串
        Returns:
        结果
      • sha384

        public static java.lang.String sha384​(java.lang.String text)
        使用HMAC-SHA1进行消息签名, 返回字节数组,长度为20字节.
        Parameters:
        text - 原始输入字符串
        Returns:
        结果
      • sha384

        public static byte[] sha384​(byte[] b)
        使用HMAC-SHA1进行消息签名, 返回字节数组,长度为20字节.
        Parameters:
        b - 原始输入字符串
        Returns:
        结果
      • sha512

        public static java.lang.String sha512​(java.lang.String text)
        使用HMAC-SHA1进行消息签名, 返回字节数组,长度为20字节.
        Parameters:
        text - 原始输入字符串
        Returns:
        结果
      • sha512

        public static byte[] sha512​(byte[] b)
        使用HMAC-SHA1进行消息签名, 返回字节数组,长度为20字节.
        Parameters:
        b - 字节数组
        Returns:
        结果