Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Encryption...

Status
Not open for further replies.

youradds

Programmer
Jun 27, 2001
817
GB
Hi. What is the PHP's way of doing MM encryption (for a .htpasswd file). Perls way is crypt($admin_password, "MM");, but I cant seem to find a way to do it with PHP :(

Anyone know?

Thanks

Andy
 
PHP also uses the one-way 'crypt()' hashing algorithm.
The prototype is:
string crypt (string str [, string salt])

So you might do something like:
$password = "mycrazypass";
$encrypted_password = crypt($password, 'xx');

Or you could verify a correct password like this:
if (crypt($password, 'xx') == 'xxkT1mYjlikoII') {
do_something();
}

Hope that's helpful,
Bryan
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top