EMV MAC

The EMV smart card standards define MAC generation and verification processes that are the same as ANSI X9.9 and ANSI X9.19 Optional Procedure 1 (ISO/IEC 9797-1, Algorithm 3), except for padding added to the end of the message.

Append one byte of X'80' to the original message. Then append additional bytes, as required, of X'00' to form an extended message, which is a multiple of eight bytes in length.

In the ANSI X9.9 and ANSI X9.19 Optional Procedure 1 standards, the leftmost 32 bits (4 bytes) of On are taken as the MAC. In the EMV standards, the MAC value is between four and eight bytes in length. CCA provides support for the leftmost four, six, and eight bytes of MAC value.
Figure 1. MAC calculation method

MAC calculation method