3
$\begingroup$

What is the strength of $H(k \| H(m))$ compared to HMAC? Compared to $H(m \| k)$? What is the strength in bits of a given key/output size?

$\endgroup$
0

2 Answers 2

3
$\begingroup$

Should be comparable in strength to $H(m||k)$. The weakness is that a collision in the inner hash breaks the MAC. Using strong hashes the strength in bits is $\min(2^{n_O},2^{{n_I}/2})$ where $n_O$ is the output size of the outer hash and $n_I$ the output size of the inner hash.

But since cryptoanalysis usually breaks collision resistance long before it breaks keyed modes like HMAC, it's riskier than the security loss against generic attacks indicates.

$\endgroup$
3
$\begingroup$

The strength here depends on the collision resistance of $H$. If $H$ is not collision resistant, like MD5, then the attacker can find $H(m) = H(m')$, ask for the MAC of one message and forge it for the other.

So for many secure hashes you lose half the security bits. E.g. SHA-256 should give you a 256-bit secure HMAC, but would be at most 128-bit secure in this construction, because its collision resistance is much lower than its preimage resistance.

So you need to assume more about the hash function. HMAC has proofs which do not require collision resistance. This one cannot have such proofs, and its proofs will at least have to assume collision resistance. Possibly other properties.

Compared to $H(m \| k)$?

The story there is similar. A collision attack breaks that MAC. However, at least you do not need two calls to the hash function so you have something faster than HMAC...

($H(k \| H(m))$ is no faster than HMAC, if you cache the result of the inner key hash, which gets used as a chaining value/IV for the inner message hash in HMAC.)

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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