0
$\begingroup$

Is it useful to combine HMAC with Bcrypt ?
If it so, should I do the HMAC on the password before "Bcrypt"ing it ? or should I do the HMAC on the Bcrypt output ?

$\endgroup$
1
  • 1
    $\begingroup$ Rather than do this yourself, just use argon2 which has an explicit parameter for this. $\endgroup$ Jul 29 at 2:41
1
$\begingroup$

The goal of a pepper is to protect passwords in the event that a database of password hashes is compromised but other parts of the authentication system are not compromised.

Password hashing functions' output contains their input parameters, salt, and the digest, so obscuring it irretrievably via HMAC would make it impossible to verify a user's password. Storing the plaintext password hash output next to the "peppered" HMACed output would leak the "unpeppered" value. Therefore, you apply the pepper on the input.

Nothing about this differs from hash to hash, it's the same for bcrypt as it is for PBKDF2 or Argon2 or Pufferfish2 or any other Password Hashing Function...

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.