note 68054 added to function.mcrypt-create-iv

From: Date: Tue, 11 Jul 2006 20:26:49 +0000
Subject: note 68054 added to function.mcrypt-create-iv
Groups: php.notes 
Request: Send a blank email to php-notes+get-114679@lists.php.net to get a copy of this message
After profiling a rather large, dynamic website I maintain to determine the cause of intermittent freezing in execution, I found that calls to mcrypt_create_iv() using DEV_RANDOM as the source consistently halted execution for anywhere from 0.2 to ~12 seconds per call, ironically at random. I'm making the assumption that the halts were caused by insufficient random input being currently available in /dev/random due to its intended function to block until enough random input is provided back to the device. I've found it to be sufficient for my needs to use a modified version of the alt_mcrypt_create_iv() function found below. Although untested, I assume using DEV_URANDOM or a combination of DEV_RAND with srand() would've solved the problem as well; I found out after the fact that /dev/urandom's intended function is to seamlessly provide cryptographically secure output from the random number generator when the /dev/urandom buffer was empty, and DEV_RAND would simply use the same rand() function as alt_mcrypt_create_iv(). -Kevin Kaiser ---- Server IP: 66.163.161.117 Probable Submitter: 75.9.130.114 ---- X-Spam-Status: No, hits=3.1 required=5.0 tests=DATE_MISSING,FROM_NO_LOWER autolearn=no version=2.64 ---- Manual Page -- http://www.php.net/manual/en/function.mcrypt-create-iv.php Edit -- http://master.php.net/note/edit/68054 Del: integrated -- http://master.php.net/note/delete/68054/integrated Del: useless -- http://master.php.net/note/delete/68054/useless Del: bad code -- http://master.php.net/note/delete/68054/bad+code Del: spam -- http://master.php.net/note/delete/68054/spam Del: non-english -- http://master.php.net/note/delete/68054/non-english Del: in docs -- http://master.php.net/note/delete/68054/in+docs Del: other reasons-- http://master.php.net/note/delete/68054 Reject -- http://master.php.net/note/reject/68054 Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#114679) next »