mcrypt_create_iv - why so slow?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi folks,

This code:

<?php
$iv = mcrypt_create_iv(mcrypt_get_iv_size(MCRYPT_RIJNDAEL_256,
MCRYPT_MODE_CBC), MCRYPT_DEV_RANDOM);
var_dump($iv);

Takes just over a minute to run on my laptop and roughly 45 seconds on a
capable server, any idea why?

time php test-iv.php
string(32) "????'???H??y?PJ?U?1O;6???ѧ"

real 0m44.917s
user 0m0.024s
sys 0m0.036s

Also, I've noticed the mcrypt_encypt & mcrypt_decrypt complain with

The IV parameter must be as long as the blocksize

when not using mcrypt_create_iv, however, if the value of the IV parameter
is consistent in both calls, the decryption seems to succeed despite the
warning.

So wondering:
* can the call to mcrypt_create_iv be sped up
* is there an alternative (faster) way to create a proper iv
* how big a risk is it to 'ride dirty' here and not use mcrypt_create_iv

thanks,

-nathan

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux