Re: encrypting /descrypting a password
| From: | Joe Stump | Date: | Fri, 24 Nov 2000 10:02:48 +0000 |
| Subject: | Re: encrypting /descrypting a password | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-26923@lists.php.net to get a copy of this message | ||
I've seen it done with md5() - just make a key, say '5643225', then take a
person's password and concatonate the two - like this:
$encrypted_pass = md5($password.$key);
Then when someone logs in grab the password from the DB and put your key on the
end, and do the same with the entered password - if they equal each other then
they are good to go.
This lets you store an encrypted password in a cookie easily.
--JOe
On Fri, Nov 24, 2000 at 10:55:18AM +0100, Mattias Segerdahl wrote:
> I'd say go with mysql's own password() method..
>
> insert method: insert into users (id,username,password)
> values('$id','$username',password('$password'));
> select method: select id,username,password from users where username =
> $username and password = password('$password');
>
> // Mattias aka efnet's #php bad2da
>
> ----- Original Message -----
> From: <hennink@patrijs.max.nl>
> To: <php-general@lists.php.net>
> Sent: Friday, November 24, 2000 10:59 AM
> Subject: [PHP] encrypting /descrypting a password
>
>
> > Hi,
> >
> > I'm working on a authorizationenvironment and now I've to decide how to
> > store my password's in Mysql.
> > What would be the safiest solution?
> > What if I choose des to encrypt the given password in de dbase?
> > How could I check that when a user is logging in that the given password
> > is
> > the same as the one that is encrypted because there is no decrypt to see
> > if the passwords match.
> >
> > With regards,
> >
> > Tijmen
> >
> > --
> > Customer: I'm running Windows '98
> > Tech: Yes.
> > Customer: My computer isn't working now.
> > Tech: Yes, you said that.
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
> > For additional commands, e-mail: php-general-help@lists.php.net
> > To contact the list administrators, e-mail: php-list-admin@lists.php.net
> >
> >
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
> For additional commands, e-mail: php-general-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net
================================================================================
= Joe Stump joestump98@yahoo.com http://www.miester.org =
================================================================================
Need a programmer? http://www.google.com/search?q=joe+stump+resume