NYCPHP Meetup

NYPHP.org

Crypt issue??

Jeff jsiegel1 at optonline.net
Fri Jun 6 17:37:01 EDT 2003


Not sure how to handle this one.


I have a simple function using crypt for storing passwords:

	function EncryptString($strToEncrypt){
		$tmp = crypt(trim($strToEncrypt),"MYSALT"); //One way
encryption
		return $tmp;
	}


When a user creates a new password it returns one value. When a user
tries to log in (and I call this function again) it returns a different
value yet...if I edit the user's record using one of my forms, THEN
everything works fine (that is, then the user can log in).

What seems to be happening is that when adding a new record crypt
returns a different value than when I'm editing that record. This
doesn't really make sense.

It's probably a code issue but I can't see any differences in the way
I'm calling the function.
When it encodes the password '12345' when adding the record it generates
"WOjDi2e3GGR4U"
But when I test the login function it generates "WOxvmVFSIQUTU"

In both cases I'm using this to call the function:
$tmpPwd = EncryptString($_POST['DU_sPwd']);

Any clues?

Jeff




More information about the talk mailing list