While best practice for storing passwords requires that they be stored in a hashed format with a unique salt, the original question actually raises a pretty good point: if you store the salt elsewhere for hashes, the effect of these hashes that are expanded is omitted .
1) If the passwords were only hashed and stored in the database, and the site was subjected to SQL Injection, then the attacker can “crack” the hashes
2) If the passwords were hashed with salt, and both the hashes and the salts were in the database, and the site had SQL Injection, then the attacker could “crack” the hashes, but would require more computational effort (since there doesn’t increase the performance of the previously calculated tables)
3) If the passwords were hashes with salt, and the salt was stored somewhere else, then SQL Injection will provide an attacker with a little leverage to establish the actual password.
Scenario 1 is obviously the weakest, but the security difference between 2 and 3 is less clear and depends on the relative probabilities of SQL Injection versus server-side code disclosure (and related vulnerability classes).
The more you trust, your ability to protect against SQL Injection or your ability to Apache / PHP / to protect your server-side content.
Things are never simple, and I actually think the idea in OP makes more sense than other answers give honor.
(You can use both the salt stored in the database and the "key" if you like to store it in the source of the web application when generating passwords).
foob
source share