reported on SHA-2, NIST selected an additional algorithm and standardized SHA-3 in 2012.
HMAC involves a cryptographic hash function and a cryptographic key. The iterative hash function breaks the message in fixed-size blocks and iterates over them. The size of the output of HMAC is the same as that of the underlying hash function, though it can be truncated if desired.
Which one of MD5 and SHA-1 is better for HMAC?
Let’s first compare MD5 with SHA-1.
The security of the MD5 hash function is severely compromised. MD5 is vulnerable to a collision attack. An attacker can find collisions in MD5 within seconds. In fact, a number of projects have published MD5 rainbow tables online, which can be used to reverse many MD5 hashes into strings that collide with the original input, and this can be used for the purpose of password cracking. So, if we think about security, SHA-1 is a better option than MD5.
Is HMAC-SHA1 better than HMAC-MD5 in terms of security?
The cryptographic strength of HMAC depends on the size of the secret key that is used. The most common attack on HMAC is the brute-force attack to uncover the underlying secret key. However, HMACs are substantially less affected by collisions than their underlying hashing algorithm alone. Therefore, HMAC-MD5 does not suffer from the same weaknesses that have been found in MD5 alone.
So, that means we can safely use HMAC-MD5. Both HMAC-MD5 and HMAC-SHA1 are good enough for our purposes.
I hope this helps. Interested readers who want to know more about how different cryptographic algorithms and Public Key Infrastructure work may want to refer to the book “Cryptography And Public Key Infrastructure.”






0 Comments