Knowing these things, we will choose the MD5 hash to encrypt our passwords. MD5 can be compromised, but that still takes a significant amount of time. MD5 is quick, easy to implement, and secure enough for our purposes. If your situation calls for more security, SHA1 will work as well, or implement SHA2 with a third-party library. No matter what you implement, if you need a strongly secured password, you need to have a password retention policy. A six-month or shorter mandatory password life will greatly reduce the chances that someone can brute-force the password.
Really don't do that. MD5 and SHA1 are not proper mechanisms to protect your passwords as they are vulnerable against space-time tradeoffs. - Use something such as bcrypt instead.
Share this highlighthttp://www.safaribooksonline.com/a/securing-php-web/37589/