|
Posted by Jerry Stuckle on 10/02/07 03:20
laredotornado@zipmail.com wrote:
> Hi,
>
> I'm using PHP 4.4.4. An odd thing is happening with the
> mcrypt_encrypt function. I am trying to encrypt a string of data (for
> password storage):
>
> $enc = mcrypt_encrypt(MCRYPT_XTEA, ENCRYPTION_KEY, $p_str,
> MCRYPT_MODE_ECB, $iv);
>
> and then I'm trying to log in later by encrypting the entered password
> and comparing it to the saved password. However, despite the fact
> that for each call, the inputs are the same,
>
> MCRYPT_XTEA = "xtea";
> ENCRYPTION_KEY = "sdlk2kcow8doq92k";
> $p_str = "demo";
> MCRYPT_MODE_ECB = "ecb";
> $iv = "jX%ukØ=";
>
> on one call I get the encrypted string, "ë;jéøÕG·" and on the other
> call, I get "ø34Avýä". What gives?
>
> Thanks, - Dave
>
Dave,
I hate to state the obvious, but obviously there is something different
between the two. mcrypt_encrypt gives the same output for the same input.
Look for differences in capitalization, '1' (one) instead of 'l' (lower
case ell) or 'I' (upper case eye), for instance. It's very easy to do.
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================
Navigation:
[Reply to this message]
|