1# MAC Overview and Algorithm Specifications 2 3A message authentication code (MAC) is used to check the authenticity and integrity of a message transmitted between two parties that share a secret key. 4 5This topic describes the key agreement algorithms and specifications supported by the system. 6 7## HMAC 8A Hash-based Message Authentication Code (HMAC) is a type of MAC involving a hash function and a secret key. 9 10The specified message digest (MD) algorithm is used to generate a MAC based on the shared secret key and the message to be exchanged. The MAC is used to check the integrity of message. HMAC introduces the shared secret key, which ensures data authenticity. The generated MAC has a fixed length. 11 12The **Supported Type** column in the following table lists the algorithm to be used when a **Mac** instance is created. 13 14| MD Algorithm| Supported Type| API Version| 15| -------- | -------- | -------- | 16| HASH | SHA1 | 9+ | 17| HASH | SHA224 | 9+ | 18| HASH | SHA256 | 9+ | 19| HASH | SHA384 | 9+ | 20| HASH | SHA512 | 9+ | 21| HASH | SM3 | 10+ | 22| HASH | MD5 | 12+ | 23 24 25## CMAC 26 27A Cipher-based Message Authentication Code (CMAC) is a type of cryptographic checksum used to ensure data integrity and authenticity. 28 29A block cipher (such as AES) and a key are used to generate an authentication code, which verifies that a message has not been alerted during transmission. 30 31| Encryption Algorithm| API Version| 32| -------- | -------- | 33| AES128 | 16+ | 34| AES256 | 16+ | 35