0

So passwords should not be stored in plaintext but many do anyway. For the others is there a standard way passwords are stored? I mean a SHA1 hash or MD5 hash and if so what will the salt size be? Is there a better place to ask this?

I am trying to pick the brains of sys admins and consultants working on directory services. I am trying to see if there is a pattern or not.

EDIT: I would like to clarify that I am not trying to learn how to store the passwords better myself but more trying to see how many different ways they are stored and if there is a standard if any.

user220201
  • 4,514
  • 6
  • 49
  • 69

3 Answers3

1

MD5 has been broken for a while and SHA-1 also has problems.

If you want to store a hash that will be secure for a long time to come, SHA-256 or SHA-512 (part of the SHA-2 family of hashes, designed as secure replacements for SHA-1) are a good choice and somewhere between 128 and 256 bits of salt are standard.

However, the use of plain hashes is not the best way to do this nowadays. Adaptive hashes are specifically designed for this type of storage as the amount of time necessary to compute a result can be made to slow down with additional computations. This is a very important trait to have to prevent brute-force attacks against your stored passwords. A strong, and standard, implementation of an adaptive hash is bcrypt, based on modifications to the Blowfish encryption algorithm to make it suitable for this purpose (which is explained well here).

0

Passwords should be hashed and the hashes should be stored in the database. However SHA* and MD5 are too fast a hashing algorithms to be used for the purpose of hashing passwords. For hashing passwords, you'd ideally want something much slower which doesn't lend itself well to brute force/rainbow table attacks.

You can sure hash a password 1000s of times before storing the hash to make it time and computationally intensive but why bother doing that when you have algorithms like bcrypt that do the job for you.

You should use bcrypt to hash your password. Read more about it at http://codahale.com/how-to-safely-store-a-password/

In bcrypt, since the salt is appended to hash - you don't even need two columns 'password_hash' and 'salt' in the table. Just 'password_hash'. The less clutter the better.

CodeExpress
  • 2,202
  • 1
  • 20
  • 16
  • I wish the person who downvoted could explain why he thinks bcrypt would be a bad choice (or whatever the reason was for downvoting) !! – CodeExpress Feb 07 '12 at 18:55
-1

You can see this question for the answer to how long the salt should be (between 128-256 bits seems to be the consensus).

As far as what algorithm to use, you should definitely use SHA1. MD5 was considered broken long ago even though it is still commonly used (see wikipedia MD5.

Community
  • 1
  • 1
EverPresent
  • 1,903
  • 17
  • 21
  • While SHA1 is much better than MD5, it was not designed for storing passwords. You should use something like `bcrypt`. See the answers from @jeffsix and @Shivam – dave1010 Jul 03 '12 at 10:09