I will be storing personal user information in my MySQL database, such as passwords, e-mail addresses and phone numbers. I was wondering if it's a good idea to encrypt this data with my own logic, or to use existing hash functions instead? Just to give you a simple example of what I was thinking of: if a user chooses 'pass' as his password, on the client side of the database connection I would set my encrypted password to be the chosen password's characters mingled with a bunch of other random characters. For example: I would choose to have the first character of 'pass' to be the 3rd character of the encrypted, the second character would be the 9th, the third would be the 11th and the fourth would be the 16th. That way the encrypted password would be stored in the database like this:
0fpdr76ga5sy022sch09 (this is just a simplified example, the actual encryption will be a little longer and a little more complicated)
As you can see, the chosen password is 'hidden' in the encrypted password (the letters in bold) and I am the only one who knows where the password's characters are (assuming no one will ever get access to my application's source code, where the encrypting and decrypting actually happens). If I want to retrieve the password from the database I would know exactly how to decrypt it and get to the actual password, while an outsider would not know what to do with it if he ever got his hands on my data. This is my just my assumption, though, I'm still very new to the programming world, so I was wondering if a more experienced programmer could give me some advice on this. Is this a safe approach? And if not, why? What are the risks and/or downsides to doing it like this?