Take the 2-minute tour ×
Cryptography Stack Exchange is a question and answer site for software developers, mathematicians and others interested in cryptography. It's 100% free, no registration required.

Reading the question “HMAC-SHA1 vs HMAC-SHA256”, I figured out that the known attacks on SHA1 don't apply to its HMAC version. So, HMAC-SHA1 is quite strong right now.

In a protocol like SSL, if it gets broken tomorrow, we can “simply” turn off all the cipher-suites that use HMAC-SHA1. But what if it is used as MAC protection for encrypted data storage? Let's say that I decide to use HMAC-SHA1 instead of HMAC-SHA256 and the former gets broken. It would be a problem because the old stored data will continue to have a broken MAC protection.

Would using HMAC-SHA256 help in that case?

To be more precise: Is HMAC-SHA256 likely to be much difficult to break compared to HMAC-SHA1 and are both HMAC-SHA1 and HMAC-SHA256 likely to be broken in the near future?

share|improve this question
MD5 is badly broken, but HMAC-MD5 is standing relatively strong. SHA1 is broken, but not so badly, draw your own conclusions about HMAC-SHA1. I would worry more of a key leak by machine compromise or side-channel than by theoretical weakness of HMAC-SHA1. –  fgrieu May 2 at 17:15
In encrypted data storage, it is wise to choose the algorithms according to how long the data is to remain cryptographically protected (such as confidentiality or integrity protected). However, it is generally possible to upgrade integrity protection of stored data: just recalculate all macs using a stronger algorithm. Various recommendations (such as NIST) would allow HMAC-SHA1 to be used for data stored up-to (and somewhat beyond) 2030. For data protected longer period of time, something else such as HMAC-SHA256 is good pick, to prevent the need to "upgrade" algorithm during storage period. –  user4982 May 3 at 7:19

Your Answer


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

Browse other questions tagged or ask your own question.