Reply to Re: [PHP] mcrypt_generic_init(): Iv size incorrect

Your name:

Reply:


Posted by Mike Hummel on 04/19/05 16:37

So this solution does work, however it doesn't answer the question as to
why this is occurring in the first place.
Rather then finding a work around for it, I'd like to know why PHP /
mcrypt is throwing the error. Is it an issue in the library itself?

Tom Rogers wrote:
> Hi,
>
> Saturday, April 9, 2005, 3:35:21 AM, you wrote:
> MH> I have an odd php issue with mcrypt.
> MH> I'm getting a lot of this type of error, but only sometimes:
>
> MH> mcrypt_generic_init(): Iv size incorrect; supplied length: 0, needed: 32
>
> MH> (note, the "supplied length: 0" is not always the same. sometimes it is
> MH> 1, 16, etc).
>
> MH> It doesn't seem to affect the decoding of the file, but it is throwing a
> MH> notice in to my error log. I've tried doing this:
>
> MH> @mcrypt_generic_init($this->td, $key, $iv)
>
> MH> but that doesn't stop it from throwing an error.
>
> MH> The only thing I can think is that I have
> MH> mcrypt_module_close($this->td)
> MH> commented out because my code was dying with it...
>
> MH> System:
> MH> Linux w/ Apache 1.3.31
> MH> PHP Version 4.3.4
> MH> libmcrypt version 2.5.7
>
>
> MH> Suggestions?
>
>
> I do this to set a zero iv
>
> $td = mcrypt_module_open(MCRYPT_TripleDES, "", MCRYPT_MODE_ECB, "");
> $key = substr($secret, 0, mcrypt_enc_get_key_size ($td));
> $iv = pack("a".mcrypt_enc_get_iv_size($td),$iv);
> mcrypt_generic_init ($td, $key, $iv);
>

[Back to original 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

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