Solved

Securely storing user passwords

Posted on 2009-05-19
3
222 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
  • 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

VMware Disaster Recovery and Data Protection

In this expert guide, you’ll learn about the components of a Modern Data Center. You will use cases for the value-added capabilities of Veeam®, including combining backup and replication for VMware disaster recovery and using replication for data center migration.

Question has a verified solution.

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

Suggested Solutions

If you are looking at this article, you have most likely been hit by some version of ransomware and are trying to find out if there is anything you can do, or what way you should react - READ ON!
Businesses who process credit card payments have to adhere to PCI Compliance standards. Here’s why that’s important.
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 …
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

820 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