Design Principles
The design of the HMAC specification was motivated by the existence of attacks on more trivial mechanisms for combining a key with a hash function. For example, one might assume the same security that HMAC provides could be achieved with MAC = H(key ∥ message). However, this method suffers from a serious flaw: with most hash functions, it is easy to append data to the message without knowing the key and obtain another valid MAC ("length-extension attack"). The alternative, appending the key using MAC = H(message ∥ key), suffers from the problem that an attacker who can find a collision in the (unkeyed) hash function has a collision in the MAC (as two messages m1 and m2 yielding the same hash will provide the same start condition to the hash function before the appended key is hashed, hence the final hash will be the same). Using MAC = H(key ∥ message ∥ key) is better, however various security papers have suggested vulnerabilities with this approach, even when two different keys are used.
No known extensions attacks have been found against the current HMAC specification which is defined as H(key1 ∥ H(key2 ∥ message)) because the outer application of the hash function masks the intermediate result of the internal hash. The values of ipad and opad are not critical to the security of the algorithm, but were defined in such a way to have a large Hamming distance from each other and so the inner and outer keys will have fewer bits in common. The security reduction of HMAC does require them to be different in at least one bit though.
Read more about this topic: Hash-based Message Authentication Code
Famous quotes containing the words design and/or principles:
“What but design of darkness to appall?
If design govern in a thing so small.”
—Robert Frost (18741963)
“A bureaucracy is sure to think that its duty is to augment official power, official business, or official members, rather than to leave free the energies of mankind; it overdoes the quantity of government, as well as impairs its quality. The truth is, that a skilled bureaucracy ... is, though it boasts of an appearance of science, quite inconsistent with the true principles of the art of business.”
—Walter Bagehot (18261877)