1# MAC Overview and Algorithm Specifications 2 3<!--Kit: Crypto Architecture Kit--> 4<!--Subsystem: Security--> 5<!--Owner: @zxz--3--> 6<!--Designer: @lanming--> 7<!--Tester: @PAFT--> 8<!--Adviser: @zengyawen--> 9 10A message authentication code (MAC) is used to check the authenticity and integrity of a message transmitted between two parties that share a secret key. 11 12This topic describes the key agreement algorithms and specifications supported by the system. 13 14## HMAC 15A hash-based message authentication code (HMAC) is a type of MAC involving a hash function and a secret key. 16 17A HMAC uses a specified digest algorithm to generate a MAC based on the key and message shared by communicating parties. The MAC is used to check the integrity of transmitted packets. The HMAC adds key input on the basis of the message digest algorithm to ensure information correctness. The length of the generated MAC is fixed. 18 19The **Supported Type** column in the following table lists the algorithm to be used when a **MAC** instance is created. 20 21| MD Algorithm| Supported Type| API Version| 22| -------- | -------- | -------- | 23| HASH | SHA1 | 9+ | 24| HASH | SHA224 | 9+ | 25| HASH | SHA256 | 9+ | 26| HASH | SHA384 | 9+ | 27| HASH | SHA512 | 9+ | 28| HASH | SM3 | 10+ | 29| HASH | MD5 | 12+ | 30 31## CMAC 32 33A Cipher-based Message Authentication Code (CMAC) is a type of cryptographic checksum used to ensure data integrity and authenticity. 34 35A block cipher (such as AES) and a key are used to generate a MAC, which verifies that a message has not been alerted during transmission. 36 37| Encryption Algorithm| API Version| 38| -------- | -------- | 39| AES128 | 16+ | 40| AES256 | 16+ | 41