On Tue, 2005-10-25 at 14:47 +0400, Denis Gerasimov wrote:
> > $unique_id = sha1( uniqid( mt_rand(), true ) );
> > 
> > which should be very unique and suitable for most purposes.
> 
> I really need millions of unique IDs - hashing is not suitable for this task
> (I think so) :-(. Any more ideas?

The above function could generate much more than millions of unique IDs.

You have 1.46 x 10^48 possible hashes, and with an input of the current
time in microseconds prefixed by a Mersenne Twister random number and
suffixed by additional entropy from the combined linear congruential
generator, collisions should be *very* improbable, even when generating
IDs on multiple hosts all at the same time.

-- 
Jasper Bryant-Greene
General Manager
Album Limited

e: [EMAIL PROTECTED]
w: http://www.album.co.nz/
p: 0800 4 ALBUM (0800 425 286) or +64 21 232 3303
a: PO Box 579, Christchurch 8015, New Zealand

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to