Re: [RFC] Make uniqid() more unique
| From: | Christoph M. Becker | Date: | Fri, 09 Sep 2016 13:56:47 +0000 |
| Subject: | Re: [RFC] Make uniqid() more unique | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-95865@lists.php.net to get a copy of this message | ||
On 09.09.2016 at 07:12, Yasuo Ohgaki wrote:
> We all know, uniqid() is not unique at all and not safe as random ID
> at all. This would be one of the most misused function because of its
> name.
uniqid() yields truly unique values for a single machine (except for
CYGWIN, and potentially older Windows versions), if $more_entropy is
FALSE[1]. Of course, the function shouldn't be used for any crypto
purposes, but it is fine to get a unique ID if you have no database that
delivers a sequential index number (aka. autoincrement field), for instance.
[1]
<https://github.com/php/php-src/blob/PHP-7.0.11/ext/standard/uniqid.c#L68>
--
Christoph M. Becker