Jorge Godoy wrote:
> "Evan Monroig" <[EMAIL PROTECTED]> writes:
> > I know that php has a function 'uniqueid' for this purpose, but I
> > haven't hanged around in python enough to know anything equivalent...
>
> What's the implementation of uniqueid?  Some random number?

Sorry in fact I mistook the name. It is uniqid and there is some
documentation here (http://jp2.php.net/uniqid) from which I will quote:

----
 uniqid() returns a prefixed unique identifier based on the current
time in microseconds. prefix  is optional but can be useful, for
instance, if you generate identifiers simultaneously on several hosts
that might happen to generate the identifier at the same microsecond.
Up until PHP 4.3.1, prefix could only be a maximum of 114 characters
long.

If the optional more_entropy parameter is TRUE, uniqid() will add
additional entropy (using the combined linear congruential generator)
at the end of the return value, which should make the results more
unique.

[...]

 If you need a unique identifier or token and you intend to give out
that token to the user via the network (i.e. session cookies), it is
recommended that you use something along these lines:

<?php
// no prefix
$token = md5(uniqid());

// better, difficult to guess
$better_token = md5(uniqid(rand(), true));
?>

This will create a 32 character identifier (a 128 bit hex number) that
is extremely difficult to predict. 
----

hope this helps

Evan

Reply via email to