Glossary

Learn about data security, encryption, hashing and encoding in our knowledge base.

MAC

In the context of encryption, a message authentication code (MAC) is a short message that is created by encrypting a message digest (a unique representation of the message) using a secret key. It is attached to the message and can be used to verify the integrity of the message by decrypting the MAC using the same key and comparing the resulting message digest to a new message digest that is created from the received message.

MACs are used to provide a tamper-evident seal on a message and to prove that the message was created by a specific individual or entity. They are a key component of many security protocols and are widely used to secure communication and transactions over the Internet.

To create a MAC, the sender of the message first creates a message digest (a unique representation of the message) using a hash function. The message digest is then encrypted using the secret key to create the MAC. The MAC is attached to the message and transmitted to the recipient.

To verify the MAC, the recipient of the message uses the same secret key to decrypt the MAC and compare the resulting message digest to a new message digest that is created from the received message. If the message digests match, the MAC is considered to be valid, and the message is authenticated as having been sent by the sender. If the message digests do not match, the MAC is considered to be invalid, and the message is considered to have been tampered with or altered during transmission.

MACs provide a number of benefits, including:

  • Non-repudiation: MACs provide evidence that a specific individual or entity created the message, which makes it difficult for the sender to deny having sent the message.

  • Integrity: MACs help to ensure that the message has not been tampered with or altered