Algorithms like MD5, SHA1 are not encrypting but hashing the source text of any length to a output string of fixed length. And donot use them to protect your user's password.
Let me tell you a good way. Ask for a secret question. Answer of this secret question will be the secret key of our password encryption algorithm. Now you use MD5 or whatever to hash this answer. Now encrypt the password using this hash as secret key (use symmetric key algorithms such as AES). This will help in a way, so that if the user forgets his password, then only that user and no one else will be able to recover the password.