tags:

views:

218

answers:

2

I'm thinking of hashing user passwords with two different salt strings, one stored in the code which is the same for all users and another stored in the database for which each user has their own unique value.

Would this be more effective than simply storing the values in the database?

Any advice, opinions appreiated.

Thanks

A: 

Best practice is to hash with a salt and store both the salt and the hash in the database.

And you want to do it differently why?

Will
Downvoted for lazy non-answer.
Mike Daniels
@Mike don't be a douche. It isn't lazy (I'd just downvote his question and move on), and its the right answer. There is NO REASON to do what he's asking. He should stick with the best practice unless he has a GOOD REASON to do so.
Will
@Mike Upvoted your downvote for giving a clear reason :)
Jayrox
Saying something is a "best-practice" with no explanation is lazy. There are lots of "best-practices" that turn out not to be best when actual thought is applied. Now, in this case, it's true, there's not much benefit to adding an extra, fixed salt to the hash; but you could explain *why* this is the case (like the accepted answer), instead of just "best-practice, you're wrong."
Brian Campbell
So there are more than one completely different ways to store passwords in a database that are all considered equally "the best"? Obviously not. I guess I could have discoursed on the intricacies of cryptographic hash theory, which would have not been lazy. BRB, writing a pointless thesis on it right now....
Will
+7  A: 

The effect is miniscule if anything at all. Consider that a static, hard coded salt can be viewed as nothing more than an alteration to the hashing algorithm - it happens exactly the same way every time, so it may as well be considered part of the algorithm.

But the purpose of the salt is to create some randomness that is similar to extending the (minimum) strength of the password, for the purpose of making offline cracking (including rainbow tables) more resource intensive (non-rainbow-table cracking will require more CPU time, and rainbow tables will require all salts for all strings).

The only way that you'd get any value from this is while the static salt is unknown - the equivalent to the algorithm being unknown. If your binary or your source is available to the attacker, then reverse engineering will demonstrate the algorithm and the hard coded salt.

And if this issue goes public, you will probably have to deal with flack from many security enthusiasts who believe that anything not perfect is completely broken, even though your product already does the right thing and the additional step is just useless.

And, of course, you'll have to deal with maintenance issues of having a static salt - backwards compatibility and bug fixes around the hashing code can be a pain.

The very small benefit of static keys (or salts) is simply not worth the cost. Always make keys and salts dynamic.

atk
Thanks for that, really helpful!
Dan