You are here: Re: How to store and retrieve encrypted password? « All PHP « IT news, forums, messages
Re: How to store and retrieve encrypted password?

Posted by J.O. Aho on 01/31/06 01:56

gene.ellis@gmail.com wrote:
> I am using PHP to allow users to create profiles on our website and
> store them in a MS SQL database and I am wondering, how can I encrypt
> the passwords? Also, how would I be able to match the right password
> when it is time to retrieve the password from the database? Thank you
> very much for your help!

For a really simple encryption you can use str_rot13(), you just modify the
password before you save it to the database and decrypt it after you fetched
it from the database.

$encrypted=str_rot13($password);

$password=str_rot13($encrypted);


If you want more secure encrypting, then use mcrypt_ecb(), works pretty the
same way and allows you to choose different encryption methods.


You have the crypt() function, the name is not that good really, this code
makes a one way "encryption" and this prevents you to resend the current
password to the user, here you solve the problem by generating a random string
which you send to the user and hash it before you store it in the database.



//Aho

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация