Re: Re: Unique ID on 5.0.4 (Windows)
| From: | Jasper Bryant-Greene | Date: | Thu, 22 Sep 2005 20:25:44 +0000 |
| Subject: | Re: Re: Unique ID on 5.0.4 (Windows) | ||
| References: | 1 2 3 4 5 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-223021@lists.php.net to get a copy of this message | ||
Chris wrote:
Jasper Bryant-Greene wrote:Because if you take a look at the output of uniqid( mt_rand(), true ) you will see that it changes in length each time it is run, whereas after running through sha1() it is always 40 characters I just find that the output of sha1() looks tidier anyway. -- Jasper Bryant-Greene Freelance web developer http://jasper.bryant-greene.name/$unique_id = sha1( uniqid( mt_rand(), true ) ); That unique ID will be based on the current time in microseconds prefixed by a random number generated by the Mersenne Twister. That is *extremely* unlikely to duplicate, even at the same microsecond.Ok, thanks, That looks like it will work for me. Any particular reason why you used sha1() in there?