1
$\begingroup$

I am reading through an information security book right now, and a confusing question poses itself to me:

"Could you use a MAC as a HMAC? That is, does a MAC satisfy the same properties that a HMAC satisfies?"

The book then goes on to give a hint about how MACs are computed by CBC mode of a given symmetric block cipher that involves K the key, and to consider when K is known to an attacker for both HMAC and MAC.

Here's the confusing part: Isn't a MAC just a code created from a MAC algorithm, while a HMAC is a type of MAC algorithm? I do not see how any of these hints could be applicable to the question when a MAC and a HMAC are so clearly similar (to a novice).

Am I right in this thinking?

| improve this question | | | | |
$\endgroup$
  • 1
    $\begingroup$ Does this give an answer to your question What is the difference between MAC and HMAC? $\endgroup$ – kelalaka Mar 1 at 16:28
  • 1
    $\begingroup$ Your understanding is correct and the book is using the terms incorrectly. Could you share which book this is? $\endgroup$ – Maeher Mar 1 at 16:44
  • 1
    $\begingroup$ Please use the edit feature for corrections, clarifications, and cleanup only. This network of websites frowns upon edits that change the direction of a question from its original form. It's preferred that people post new questions instead. $\endgroup$ – Future Security Mar 3 at 18:07
5
$\begingroup$

HMAC is a type of MAC. The output of a MAC is called a "tag". Not all MAC (algorithms) are HMAC.

MACs are not required to be one-way or collision resistant for someone who knows the key. HMAC, however, inherits the one-way-ness and collision resistance of the underlying hash function.

A CBC-based MAC is mentioned as a hint because it is almost trivial to find preimage values for any given tag value. That also makes collision attacks trivial.

| improve this answer | | | | |
$\endgroup$
  • $\begingroup$ A related answer from the question kelalaka linked, which I didn't notice. I didn't mention PRFs, but it is another important aspect of HMAC. (All PRFs can be used as MACs, but not all MACs can be used as PRFs.) $\endgroup$ – Future Security Mar 3 at 22:04
1
$\begingroup$

"Could you use an MAC as an HMAC? That is, does a MAC satisfy the same properties that an HMAC satisfies?"

No, only HMAC is a HMAC. And of course any common MAC can be used in the same role as HMAC, as HMAC is just a MAC after all.

However, terms can be confusing here. HMAC is a specific algorithm, however MAC can have two different meanings: MAC could be a generic term for a message authentication code, or it could mean a MAC that is build from a block cipher. Unfortunately there is no specialized term or acronym for the latter.

So basically we are left with the following tree:

                    MAC
                  /     \   ...
                MAC       ?
              /   \      /   \ 
           CMAC   CBC-  HMAC  KMAC
                  MAC

Which makes little to no sense at all.

Better call the second MAC "cipher-based MAC" and call the "?" a "hash-based MAC" then.

| improve this answer | | | | |
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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