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.

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

share|improve this question
add comment

1 Answer 1

up vote 4 down vote accepted
  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.

share|improve this answer
1  
Step 3 is essential, do not skip it. –  David Schwartz Apr 14 '13 at 13:36
1  
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. –  Paŭlo Ebermann Apr 14 '13 at 14:31
    
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 ? –  IvanP Apr 14 '13 at 20:54
    
@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)). –  CodesInChaos Apr 14 '13 at 21:42
    
That is exactly what I meant. Thanks. –  IvanP Apr 14 '13 at 22:21
add comment

Your Answer

 
discard

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

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