This is in excess of what you need, but I think its worth a mention as we are on this topic

The safest way to secure a password would be to use a oneway hashing algorithm like md5 or shl1
You then save the hashed password in the database, then everytime the user enters a password, it gets hashed and compared to the hashed password in the database. This has the added bonus of keeping the password hidden from system admins who have access to the database.
Because there are a lot of sites out there that store a massive database of hashed words, so you simply give it the hash and it returns the cleartext if its in the database, it would be wise to secure it further with a salt. The way this works is that each user will have an additional variable which should contain a random sequence of characters, thats associated with the username. That gets added to the end of the hashed password and send through the hashing algorithm a second time.
i.e. if I had a function called md5( String ) then each user has a record :-
Record User
Field Name : String
Field Salt : String
Field hash : String
End Record
then when I create a new User, I would also assign a random string to the Salt field.
User.Name = UserName
User.Salt = randomString( length = 6 )
Finally, when I create the hash field I would do: -
User.hash = md5( md5( Password ) + User.Salt )
where the + denotes a concatination of the hased Password and Salt.
You would use the same hashing process on the provided Password everytime the user tries to login.
This is becoming the norm for online forums/login systems too.