Subject: | Philosophical error - should never use a hash (salted or not) to protect a password |
Hashes should never be used for password protection, nor should "crypt" (since it uses hashes). offline dictionary attack is your enemy.
There are dedicated solutions to this fascinating problem, which are generally called "Password Based Key Derivation Functions" - they all boil down to the same plan: you need to work out the computational power available in your architecture, and the rate at which passwords need to be checked, and pick a corresponding difficulty level to feed into the protection. You can make password-checking take 100% CPU for 1 second on single-user systems (a good choice), or you may need it to take much less power on heavily loaded many-user website systems (for example).
No one size fits all, but "hash" in any size fit no-one!
To fix this "bug", you need to add an actual password crypt solution here, designed (properly!) specifically for passwords.