slow mcrypt_create_iv()
| From: | Chuck Theobald | Date: | Wed, 24 Oct 2001 20:23:48 +0000 |
| Subject: | slow mcrypt_create_iv() | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-72155@lists.php.net to get a copy of this message | ||
Hi,
I have a system of programs that use mcyrpt routines. The first few times
I run through the routine containing mcrypt_create_iv it returns quite
quickly, but afterwards, this function can take from 5 to 15 seconds to
return.
The function wrapping the encryption routines is as follows:
$this->cipher = MCRYPT_TripleDES;
$this->mcrypt_mode = MCRYPT_MODE_ECB;
$this->randomizer = MCRYPT_DEV_RANDOM;
function encrypt_and_hex($input) {
include '/www/php/key.inc';
$td = mcrypt_module_open ($this->cipher, "", $this->mcrypt_mode, "");
$iv_size = mcrypt_enc_get_iv_size ($td);
$iv = mcrypt_create_iv ($iv_size, $this->randomizer);
mcrypt_generic_init ($td, $key, $iv);
$output = bin2hex(mcrypt_generic ($td, $input));
mcrypt_generic_end ($td);
return $output;
}
I get similar delays in the decryption routine. Any ideas as to why it
slows down and/or how to fix it would be appreciated.
Thanks,
Chuck
Chuck Theobald, Technology Manager
ERIC Clearinghouse on Educational Management
5207 University of Oregon, Eugene, OR, 97403-5207
800-438-8841
* 541-346-1662 (voice) * 541-346-2334 (fax) * 541-337-0182 (cell) *
* http://eric.uoregon.edu/ * mailto:ctheobald@eric.uoregon.edu *