0

I know for a fact that salts are an important part of storing a password securely in a database. Most people store the password hash, and the salt that was used for it. This, I have learned, isn't as safe as many would think, as a dedicated cracker could use a dictionary attack to find out the password (granted he knew how you were using the salt).

Therefore, I am asking, is it safe to use some sort of transformed version of the password as the salt? Or is a normal salt going to do the exact same job.

(To be clear, I am not making my own crypto.)

1
  • I found this answer on stackoverflow very helpful for understanding salt when hashing passwords (it should be moved to security.stackexchange if you ask me). – Monika Dec 24 '14 at 16:42
3

The purpose of the salt is to ensure that two separate users using the same password string will not generate the same password hash. If you are deterministically defining the salt based on the password, and two users have the same password, then you'll almost certainly be selecting the same salt for both, and will have failed the original purpose of using a salt.

(One can imagine a scheme by which you determine the salt by calculating an index into the password based on the username, which would mean two different users with the same passwords would end up with different salts derived from their passwords. But, keep reading.)

In addition, my gut tells me that when you're extracting information from the password to use in the more public guise of the salt, you're in danger of leaking information about the password itself. Any of the more crypto-skilled on this site can probably give chapter and verse if that's a correct gut feel.

The bottom line is really that secrecy is not required for the protection that the salt provides. It is not intended to supplement poor password quality, only to make two equal passwords result in different hashes, thus making brute force attacks more expensive. You should consider carefully whether you truly get any security improvement by making it more complex - and I think the answer is no.

0

isn't as safe as many would think, as a dedicated cracker could use a dictionary attack to find out the password

As gownfawr said, the job of the salt is to ensure that two users with the same password don't have the same hash stored in the database. It is the job of the hashing algorithm and the password's complexity to protect it from dictionary + brute force attacks. The salt does not have to be obscured within the database. Another salt (actually called a pepper) is sometimes hidden/stored elsewhere and used to further salt the hashed passwords and provide the obscurity that you are suggesting.

gownfawr is right that your idea of deriving the salt from the password would defeat the purpose of the salt.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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