[Q]:Generate Unique ID's

Paul Rubin http
Sat May 24 20:23:49 EDT 2003


Uwe Schmitt <uwe.schmitt at procoders.net> writes:
> I use something like:
> 
> import md5, time
> 
> m = md5.md5()
> m.update("myname%s" % time.time())
> res = m.hexdigest()
> m.update("myname%s" % time.time())
> res += m.hexdigest()

This is very dangerous because remember that the application is
supposed to run on lots of different computers simultaneously, and
their clocks might not be synchronized.

> You can use your ip-adress/mac-adress/.... instead of 'myname'.
> The result should be 'very' unique.

That helps, for sure.




More information about the Python-list mailing list