note 92847 added to function.mcrypt-create-iv
| From: | MarkSeecof at osu1 dot php dot net | Date: | Tue, 11 Aug 2009 18:15:58 +0000 |
| Subject: | note 92847 added to function.mcrypt-create-iv | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-159340@lists.php.net to get a copy of this message | ||
The official documentation above is outdated and misleading. It does not match the actual behaviour
of the function on PHP 5.3+.
On PHP 5.3+ you may set the '$source' argument to MCRYPT_DEV_RANDOM or MCRYPT_DEV_URANDOM
on ANY platform, including Windows, to get data from the host operating-system pseudorandom number
generator (/dev/{random,urandom} on *nix, CryptGenRandom() on Windows). MCRYPT_DEV_RANDOM and
MCRYPT_DEV_URANDOM are equivalent on Windows. The host OS PRNG is almost always the best source of
pseudorandom numbers for cryptographic purposes.
If you select MCRYPT_DEV_RAND the PHP mcrypt library will use a low-entropy internal PRNG which does
NOT produce crypto-quality pseudorandom numbers!
You SHOULD use MCRYPT_DEV_URANDOM, because attempts to read /dev/random often block. If you use
MCRYPT_DEV_RANDOM your scripts will hang unpredictably when running on a *nix platform. Keep your
scripts portable, even if you mainly develop for one platform: use MCRYPT_DEV_URANDOM.
----
Server IP: 209.41.74.194
Probable Submitter: 170.167.4.200
----
Manual Page -- http://www.php.net/manual/en/function.mcrypt-create-iv.php
Edit -- https://master.php.net/note/edit/92847
Del: integrated -- https://master.php.net/note/delete/92847/integrated
Del: useless -- https://master.php.net/note/delete/92847/useless
Del: bad code -- https://master.php.net/note/delete/92847/bad+code
Del: spam -- https://master.php.net/note/delete/92847/spam
Del: non-english -- https://master.php.net/note/delete/92847/non-english
Del: in docs -- https://master.php.net/note/delete/92847/in+docs
Del: other reasons-- https://master.php.net/note/delete/92847
Reject -- https://master.php.net/note/reject/92847
Search -- https://master.php.net/manage/user-notes.php