You are here: Re: mcrypt_encrypt giving different results for same input? « PHP Programming Language « IT news, forums, messages
Re: mcrypt_encrypt giving different results for same input?

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]


Удаленная работа для программистов  •  Как заработать на 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

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