Open In App

How message authentication code works?

Last Updated : 09 Aug, 2019
Like Article

Prerequisite – Message authentication codes
Apart from intruders, the transfer of message between two people also faces other external problems like noise, which may alter the original message constructed by the sender. To ensure that the message is not altered there’s this cool method MAC.

mac value generation

MAC stands for Message Authentication Code. Here in MAC, sender and receiver share same key where sender generates a fixed size output called Cryptographic checksum or Message Authentication code and appends it to the original message. On receiver’s side, receiver also generates the code and compares it with what he/she received thus ensuring the originality of the message. These are components:

  • Message
  • Key
  • MAC algorithm
  • MAC value

There are different types of models Of Message Authentication Code (MAC) as following below:

  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 –
If we do reverse engineering we can reach plain text or even the key. Here we have mapped input to output, to overcome this we move on to hash functions which are “One way”.

Note – symbol “E” denotes symmetric key encryption.

Previous Article
Next Article

Similar Reads

What is HMAC(Hash based Message Authentication Code)?
HMAC (Hash-based Message Authentication Code) is a type of a message authentication code (MAC) that is acquired by executing a cryptographic hash function on the data (that is) to be authenticated and a secret shared key. Like any of the MAC, it is used for both data integrity and authentication. Checking data integrity is necessary for the parties
5 min read
Difference between single-factor authentication and multi-factor authentication
1. Single-factor authentication: This authentication process is much simpler and is also considerably faster. With this Authentication process, we don’t have to face any complexity. So the first single authentication system that came out is the combination of the username and the password. The username determines the unique name of the user and the
2 min read
Message Authentication Codes
Message Authentication Codes are the codes which plays their role in two important functions: Authentication Detection and Falsification Detection. Where do we need these codes? Suppose User A send message to user B with message - 'abc'. A encrypts the message using Shared - Key Cryptosystem for encrypting the message. A sends the key to B using a
2 min read
Domain based Message Authentication, Reporting and Conformance (DMARC)
Gestation period of "@" : In 1970’s, there weren’t more awareness about threats and malicious activities. cybersecurity which was formally known as computer security was gradually progressing. Even before that Electronic Mail (E-mail) was equivalent to sticking note on someone’s computer. Because, who wouldn’t trust any message from their colleague
4 min read
Message Authentication Requirements
Data is prone to various attacks. One of these attacks includes message authentication. This threat arises when the user does not have any information about the originator of the message. Message authentication can be achieved using cryptographic methods which further make use of keys. Authentication Requirements:Revelation: It means releasing the
4 min read
hmac - Keyed-Hashing for Message Authentication
HMAC is a mechanism for message authentication using cryptographic hash functions. HMAC can be used with any iterative cryptographic hash function, e.g., MD5, SHA-1, in combination with a secret shared key. This module implements the HMAC algorithm. The basic idea is to generate a cryptographic hash of the actual data combined with a shared secret
3 min read
What is Message and Message Digest in Cryptography?
A Message is any information that flows via the network, such as files, emails, and financial transactions, from one device to another or from a set of devices. When a message is sent over a network, it must be secure to ensure that it is safe from anybody sitting in the middle listening to the conversation and having the ability to access, alter,
6 min read
Difference between Fastag, Bar Code, QR Code and NFC
1. Fastag : Fastag is a quick and easy way of payment of the toll taxes in India. It has been developed by the National Payments Corporation of India (NPCI) and is used by the National Highway Authority of India. The vehicles have a printed tag either on the glass of their cars, buses, trucks or taxis or on the hood of their motorcycles. This print
4 min read
Difference between QR Code, Bar Code and NFC
1. Barcode : Barcode is a widely used method to store information pictorially in a computer understandable format. It uses lines and spaces to store numbers. The stored numbers can be retrieved by the computer using a scanner also known as the barcode scanner. Among others, it is used extensively in retail, car rental, hospitalization industries. B
3 min read
Hamming code Implementation in C++ with receiver side verification of code
Hamming code is an error-correcting code used for detecting and correcting errors in data transmission. It adds redundant bits to the data being transmitted which can be used to detect and correct errors that may occur during transmission. Developed by Richard W. Hamming in the 1950s, it is widely used in applications where reliable data transmissi
12 min read
Practice Tags :