Class HMac

java.lang.Object
org.miaixz.bus.crypto.center.Mac
org.miaixz.bus.crypto.center.HMac
All Implemented Interfaces:
Serializable

public class HMac extends Mac
HMAC摘要算法 HMAC,全称为“Hash Message Authentication Code”,中文名“散列消息鉴别码” 主要是利用哈希算法,以一个密钥和一个消息为输入,生成一个消息摘要作为输出。 一般的,消息鉴别码用于验证传输于两个共 同享有一个密钥的单位之间的消息。 HMAC 可以与任何迭代散列函数捆绑使用。MD5 和 SHA-1 就是这种散列函数。HMAC 还可以使用一个用于计算和确认消息鉴别值的密钥。 注意:此对象实例化后为非线程安全!
Since:
Java 17+
Author:
Kimi Liu
See Also:
  • Constructor Details

    • HMac

      public HMac(org.miaixz.bus.core.lang.Algorithm algorithm)
      构造,自动生成密钥
      Parameters:
      algorithm - 算法 Algorithm
    • HMac

      public HMac(org.miaixz.bus.core.lang.Algorithm algorithm, byte[] key)
      构造
      Parameters:
      algorithm - 算法 Algorithm
      key - 密钥
    • HMac

      public HMac(org.miaixz.bus.core.lang.Algorithm algorithm, Key key)
      构造
      Parameters:
      algorithm - 算法 Algorithm
      key - 密钥
    • HMac

      public HMac(String algorithm, byte[] key)
      构造
      Parameters:
      algorithm - 算法
      key - 密钥
    • HMac

      public HMac(String algorithm, Key key)
      构造
      Parameters:
      algorithm - 算法
      key - 密钥
    • HMac

      public HMac(String algorithm, Key key, AlgorithmParameterSpec spec)
      构造
      Parameters:
      algorithm - 算法
      key - 密钥
      spec - AlgorithmParameterSpec
    • HMac

      public HMac(Mac engine)
      构造
      Parameters:
      engine - MAC算法实现引擎