3
$\begingroup$

If have application that is sending username and hashed password to server for authentication, how would I use salt for this scenario ?

$\endgroup$

1 Answer 1

4
$\begingroup$
  1. Ask the server for the salt for a specific username.
  2. Compute the expensive salted hash on the client, send to server
  3. Server performs a cheap unsalted hash(or HMAC) on the hash received from the client and compares with the stored value

Note that sending a hashed password doesn't mean you can use an insecure transport. You still need proper transport security, such as SSL/TLS/HTTPS or a specialized password verification protocol such as SRP.

$\endgroup$
6
  • 1
    $\begingroup$ Step 3 is essential, do not skip it. $\endgroup$ Commented Apr 14, 2013 at 13:36
  • 1
    $\begingroup$ The secure transport is important, too – otherwise while your password is safe, it actually doesn't protect anything, if the attacker can modify the message's contents. $\endgroup$ Commented Apr 14, 2013 at 14:31
  • $\begingroup$ For step 1 if username is unrecognized I should send random salt so it is not used for username probing ? Step 3: in database password is stored twice hashed, once with salt and than hash that result once more unsalted ? $\endgroup$
    – IvanP
    Commented Apr 14, 2013 at 20:54
  • $\begingroup$ @IvanP 1. If you want to avoid username probing, you can return HMAC(FakeSaltKey, username). A random value isn't possible since for real users the salt will not change often. 3. There is only a single stored value Hash(SaltedHash(salt, password)). $\endgroup$ Commented Apr 14, 2013 at 21:42
  • $\begingroup$ This is unsafe - do not do this. You're just turning the hash into the actual password, and storing a weak hash in the database. You need to use bcrypt on the server side. $\endgroup$ Commented Jan 24, 2020 at 11:03

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.