RE: [PHP] [Newbie] Password()
| From: | Jon Haworth | Date: | Mon, 31 Mar 2003 12:27:11 +0000 |
| Subject: | RE: [PHP] [Newbie] Password() | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-141685@lists.php.net to get a copy of this message | ||
Hi Bobby,
> In my code I am trying to send an email (containing a password)
> to a user when he has forgotten his password.
[...]
> The problem is that security leads to needing to encrypt
> passwords in the database. Im using the password function
> within mysql. Is there any way of reversing the password
> function to get the original password to send out to the user?
I think it's a one-way hash, like MD5. You could set their password to
something else - a random 8-letter string, for example - and send them that
along with a note encouraging them to change it.
If you want two-way encryption, have a look at AES_ENCRYPT and AES_DECRYPT:
http://www.mysql.com/doc/en/Miscellaneous_functions.html
(scroll down a bit)
Cheers
Jon