Can anyone let me know the difference between SHA1 and SHA1HMAC algo?

  • 2
    $\begingroup$ HMAC takes a key, plain SHA-1 does not. $\endgroup$ Commented Nov 7, 2015 at 19:26
  • $\begingroup$ @CodesInChaos you mean SHA1(Data) and SHA1(Data + Key)? Can you please explain? $\endgroup$ Commented Nov 8, 2015 at 5:43
  • 1
    $\begingroup$ SHA1 only has one parameter, the data. HMAC-SHA-1 has two parameters, key and data. Simply concatenating key and data and passing them to SHA-1 is not a good idea. SHA1(Data + Key) is much weaker than HMAC-SHA-1, since it relies on collision resistance. SHA1(Key + Data) is totally broken, due to length extensions. $\endgroup$ Commented Nov 8, 2015 at 8:05


Browse other questions tagged or ask your own question.