As always we are trying to improve password storage; before just adding new ways of storing our password we need to define what threats we will mitigate by adding in a new way to store our password.

Currently we store passwords with HMAC (using SHA-1), individual salts generated with a PRNG
(RSA X 9.31) function, the HMAC key also generated with the PRNG function.

So, currently each user password is generated as follows
securePassword = CSPRNG Salt + (HMAC-SHA1-256Function(HMAC-KEY, CSPRNG Salt+Plaintext))

So, adding a slow hash, KDF or Bcrypt etc as follows

securePassword =
CSPRNG Salt + PBKDF2 ((HMAC-SHA1-256Function(HMAC-KEY, CSPRNG Salt+Plaintext)))

What does this give us in addition to our existing solution?

All I can say it gives us is:

  1. Makes brute force more difficult i.e. slows down the brute force by significant factor.
  2. provides a way to increase the iteration counter for when computation becomes faster.

Does adding this slow hash add any other additional
security measures or prevent any other security threats?

Currently our HMAC key is held in the same database as the password,
I know not ideal, though this is outside my control.

HMAC already helps prevent against brute force so adding in the
slow hash really only provides point two above. Any other thoughts?


1 Answer 1


Since your HMAC key is held in the same database as the passwords you shouldn't count on it to do anything... If the attackers get the passwords, they get the HMAC key. So HMAC doesn't prevent brute forcing, and a password hashing function would provide both points 1 and 2 above.

Depending on your timeline you may want to consider using whatever function ends up being chosen as the winner of the Password Hashing Competition (https://password-hashing.net/). That's not expected to happen until Q2 this year though, so switching to or adding scrypt, bcrypt, or PBKDF2 in the mean time is probably a good idea.


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.