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);

-- 
regards,
Tom

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to