Re: Password encryption
| From: | Doug Thompson | Date: | Thu, 04 Mar 2004 19:43:00 +0000 |
| Subject: | Re: Password encryption | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-33313@lists.php.net to get a copy of this message | ||
On Thu, 04 Mar 2004 12:46:51 -0600, Mignon Hunter wrote:
>Can anyone recommend, or does anyone have handy, a script that will encrypt passwords AND then
>also be able to retrieve the encrypted password.
>
>Checking out the docs and some books has confused me mostly.
>
>Thx
>
Yes and no.
$pw = md5("password"); works well.
However, you cannot decrypt.
You store $pw (above) in the database and when a user wants to log in, you encrypt their entry and
compare it to the value -- also encrypted -- stored in the db. If there is a match, they get in;
but you have no knowledge of their password(s). Neither does anyone else who hacks in.
hth,
Doug