Unless there is some compelling need to be able to retrieve the actual password, just encrypt it when you store it, then the next time the password is entered, encrypt that using the same algorithm, then compare the result with the value stored in the database. You can search for one way encryption/hashing routines and get some decent information,