Solved

Securely storing user passwords

Posted on 2009-05-19
3
224 Views
Last Modified: 2012-05-07
I'm considering how to secure passwords.
Please correct me if anything appears wrong, or add things if I've missed something.

1) Store the salt in a different place(database) than the password hashes. If password hashes are stolen, salt isn't necessarily.
2) Use sha1() instead of md5() for hashes. (Storing in mysql) because sha is more resource-consuming to break than md5s.
3) What considerations should be made when choosing a salt?
4) Would it in any way make sense to trunc the sha's to 32 chars, making them look like a md5 hash?
0
Comment
Question by:letharion
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 6

Author Comment

by:letharion
ID: 24419703
Also, if one stores sha(username + password + salt), two users can have the same password, and still not the same hash. A good idea?
0
 
LVL 7

Accepted Solution

by:
askb earned 500 total points
ID: 24447695
1. Storing salts separatly in a different database does not increase the strength of the password / hash. Only the output hash/digest needs to be stored in the db for verifying the user. Note: that another added security - if you are using something like md5sum - would be that the added advantage of have the digest/hash in the database would also imply that the attacker would have to reverse the hash string to a string which equates to "pwd + salt". This would be same as finding an invariable length input string given and variable length output 128 bit hash.

2. yes - sha1 is better, and if you are considering some PKI stuff you could also try HMAC

3. Salt - can be master password/pin or any random bytes. This is what my scripts do:
md5sum(User ID + Pass + Master Pass (SALT)) = hash
NOTE: Salt can be a secondary pass or a pin number
Salts have many uses - http://en.wikipedia.org/wiki/Salt_(cryptography)

4. Not advisable - as you would be increasing the possibilies for a collision.   Assume that
1. sha1(a+B+C) = 4e1243bd22c66e76c2ba9eddc1f91394e57f9f83
2. sha1(ZZZ+B+C) = 4e1243bd22c66e76c2ba9eddc1f91394e57f9f82

Now if 1 and 2 gets truncated would be = 4e1243bd22c66e76c2ba9eddc1f91, see that last bit/char out the output digest could be diffirent.
0
 
LVL 6

Author Comment

by:letharion
ID: 24466306
That pretty much answers my question :)

Thank you very much.
0

Featured Post

Visualize your virtual and backup environments

Create well-organized and polished visualizations of your virtual and backup environments when planning VMware vSphere, Microsoft Hyper-V or Veeam deployments. It helps you to gain better visibility and valuable business insights.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Many old projects have bad code, but the budget doesn't exist to rewrite the codebase. You can update this code to be safer by introducing contemporary input validation, sanitation, and safer database queries.
Do you know what to look for when considering cloud computing? Should you hire someone or try to do it yourself? I'll be covering these questions and looking at the best options for you and your business.
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, just open a new email message. In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

759 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question