Cryptography Stack Exchange is a question and answer site for software developers, mathematicians and others interested in cryptography. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I know the definitions of both but can't specifically tell how they are different and if one is better than the other. Please help.

share|improve this question
possible duplicate of Is MAC better than digital signature? – archie Nov 1 '13 at 1:49
@archie: It is indeed a dupe, although I really think that this one is the better question of the two. On the other hand, poncho's answer over there is good, so... dunno. Maybe we could close that question as a dupe of this one, and have a mod merge the answers? – Ilmari Karonen Oct 27 '15 at 15:54
up vote 0 down vote accepted

They are used in completely different contexts. In public key encryption there is the notion of signature that protects sender authenticity. The secret key is used as the signing key and everybody can verify its correctness. On the other hand in symmetric encryption there is the notion of MAC that protects the integrity of the message with an agreed MAC key between the sender and the receiver.

share|improve this answer
So MAC can be used to protect sender authenticity like public-key encryption? – Shaily Nov 1 '13 at 1:07
no MAC is for message integrity.That is nobody has tampered with your message. Put it simpler an attacker cannot provide valid ciphertexts. – curious Nov 1 '13 at 1:08
So simply speaking, MAC cannot be used to verify sender authentication because it only protects the message integrity. Alright, thank you so much. – Shaily Nov 1 '13 at 1:11
Explain the negative vote in order to improve :) – curious Nov 1 '13 at 11:07

The main functional difference is that anyone able to verify a Message Authentication Code is also able to forge one, because the same key is used for both tasks; whereas someone with the public key can verify a digital signature, but can't forge one.

Contrary to a MAC, digital signature is thus usable in contexts where the verifier is not trusted, which is of tremendous practical value. There's a price to pay for that: a digital signature is significantly larger, and slower to generate and/or verify, than a MAC is.

share|improve this answer
+1; also, the deniability of MACs may sometimes be considered a desirable property, e.g. for encrypted private communications where you may not wish to leave the other party with a permanent proof of what you said to them. – Ilmari Karonen Oct 27 '15 at 16:01

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.