RE: [PHP] big help (md5(uniqid(rand())),0,16)
| From: | Don Read | Date: | Sat, 25 Nov 2000 12:54:08 +0000 |
| Subject: | RE: [PHP] big help (md5(uniqid(rand())),0,16) | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-27137@lists.php.net to get a copy of this message | ||
On 25-Nov-00 eric wrote:
> substr(md5(uniqid(rand())),0,16);
>
> produces:
>
> 50c0bf7a39afbf10
> 4baf448652007398
> 314fde8a1a89e247
> etc.
>
whats with the substr() ?
> HOW CAN I MAKE IT SO THE ABOVE EXAMPLED STRINGS WOULD BE GUARANTEED TO
> NEVER REPEAT?
>
YOU STORE EVERY OCCURENCE, AND TEST IF IT"S BEEN USED BEFORE !
</shout>
> OR SOMEONE TELL ME THAT THE CHANCE OF THAT HAPPENING IS... (way low)
>
yes.
srand ((double) microtime() * 1000000);
md5(uniqid(rand(), true));
> got to be VERY unguessable though. (ie. all the letters have to change.
> not just a randomzed function where just the last few chars change w/
> the changing time stamp.)
>
>
> you'd be helping me heaps. - eric dahnke
http://www.php.net/manual/html/function.uniqid.html
will also help you heaps.
--
Don Read dread@texas.net
-- The problem with people who have no vices is that you can be
sure they're going to have some pretty annoying virtues.