note 97474 deleted from function.uniqid by danbrown
| From: | danbrown@php.net | Date: | Thu, 22 Apr 2010 14:09:35 +0000 |
| Subject: | note 97474 deleted from function.uniqid by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-168516@lists.php.net to get a copy of this message | ||
Note Submitter: jaimthorn at yahoo dot com
----
On 04-Mar-2010, Robin wrote:
"A longer and more diverse unique id in the same hexit scheme can be achieved by instead
digesting uniqid() (or a series of mt_rand(), f.e.) through md5() or sha1()."
Although what Robin says is correct, this statement should not be mistaken to imply that creating a
md5/sha1 digest of uniqid() is more likely to create a unique sequence: given two uniqids, the md5s
of those uniqids are the same IF AND ONLY IF those uniqids are the same.
The md5s of two *different* uniqids, however, typically don't resemble each other very much,
even when the uniqids DO resemble each other a lot --e.g., when they were generated in quick
succession.