Working of Message Authentication Code (original) (raw)

Last Updated : 8 Apr, 2026

Secure communication over networks requires ensuring that messages are not altered and originate from a legitimate sender. During transmission, messages may be affected by malicious attacks or accidental changes, such as noise. To address this issue, a cryptographic technique called Message Authentication Code (MAC) is used.

mac value generation

Components of MAC

Working of MAC

Models of Message Authentication Code

There are different types of models of Message Authentication Code (MAC) as follows:

  1. **MAC without encryption - This model can provide authentication but not confidentiality as anyone can see the message.
  2. **Internal Error Code - In this model of MAC, sender encrypts the content before sending it through network for confidentiality. Thus this model provides confidentiality as well as authentication.
M' = MAC(M, k)  

3. **External Error Code - For cases when there is an alteration in message, we decrypt it for waste, to overcome that problem, we opt for external error code. Here we first apply MAC on the encrypted message 'c' and compare it with received MAC value on the receiver's side and then decrypt 'c' if they both are same, else we simply discard the content received. Thus it saves time.
c = E(M, k')
M' = MAC(c, k)

**Problems in MAC -

Reverse engineering may expose plain text or even key due to predictable input-output mapping, to overcome this limitation, hash functions are used, as hash functions operate in one-way manner and prevent reverse computation.

Advantages

Limitations

Applications

Important Note