Re: Deprecating uniqid()
| From: | Aleksander Machniak | Date: | Wed, 06 May 2020 13:10:58 +0000 |
| Subject: | Re: Deprecating uniqid() | ||
| References: | 1 2 3 4 5 6 7 8 9 10 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-110044@lists.php.net to get a copy of this message | ||
On 06.05.2020 14:44, Nikita Popov wrote:
> A possible candidate for this would be ULID (https://github.com/ulid/spec),
> which is basically timestamp + random + base32 encoding. The timestamp part
> makes ULIDs approximately lexicographically orderable, the random part
> makes sure things are unique when generated in parallel and the base32
> encoding avoids people having to deal with raw binary data.
Something like that. Here's some points imho are important for the
implementation:
1. The random part does not exhaust system entrophy (based on mt_rand()?).
2. it's fast.
3. it's simple, i.e. is a simple function that returns base32 string.
The only argument might be the output string length.
My 2 cents.
--
Aleksander Machniak
Kolab Groupware Developer [https://kolab.org]
Roundcube Webmail Developer [https://roundcube.net]
----------------------------------------------------
PGP: 19359DC1 # Blog: https://kolabian.wordpress.com