Hi,

Thursday, July 10, 2003, 12:41:28 AM, you wrote:
DJ> Hi All,

DJ>         I have the following function:

DJ>                 function encrypt ($x) {
DJ>                         $ini = parse_ini_file ($GLOBALS['INI_PATH']);
DJ>                     $td  = mcrypt_module_open ('tripledes', '', 'ecb', '');
DJ>                 $iv  = mcrypt_create_iv (mcrypt_enc_get_iv_size ($td),
DJ> MCRYPT_RIJNDAEL_256);

DJ>                     mcrypt_generic_init ($td, $ini["key"], $iv);

DJ>                         $encrypted_data = mcrypt_generic ($td, $x);

DJ>                         mcrypt_generic_deinit ($td);
DJ>                 mcrypt_module_close ($td);

DJ>                 return bin2hex($encrypted_data);
DJ>                 }

DJ>         I get the following PHP Warning in my logs, however, the code executes ok:

DJ>         [Wed Jul  9 10:25:49 2003] [error] PHP Warning:  mcrypt_generic_init(): Iv
DJ> size incorrect; supplied length: 0, needed: 8 in
DJ> /usr/local/apache/htdocs-uat-retail/include/nocheck.iostream.class.php on
DJ> line 87

DJ>         I have read into mcrypt, tried a couple things, but nothing will get rid of
DJ> that error.  Could someone show me what I've done wrong?

DJ> -Dan Joseph

I use this to set iv to null so I don't need to worry about it :)

$iv = pack("a".mcrypt_enc_get_iv_size($td),$iv);

-- 
regards,
Tom


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

Reply via email to