Platform-independent GUID creation?
Marc A. Mnich
marc at critters.com
Sun Jan 13 11:53:40 EST 2002
There is an open source random GUID generator at
http://www.javaexchange.com (RandomGUID.java).
It uses the local IP, local time and a large random number (seeded
with time) which is passed through an MD5 hash to come up with a
random GUID.
-Marc
"Leeuw van der, Tim" <tim.leeuwvander at nl.unisys.com> wrote in message news:<mailman.1010653814.24728.python-list at python.org>...
> Hello,
>
> I missed most of the thread, but the method I recently concocted for getting
> unique session identifiers is:
>
> import time
> import random
>
> def generateSessionID(self):
> """Attempt to generate a unique, random number or string, 32 positions
> long"""
> str = '%011d%010d%011d' % (long(random.random() * 100000000000L),
> long(time.time()),
> long(random.random() * 100000000000L))
> return str
>
>
> It won't generate Globally unique Id's, but I need them to be unique just to
> my machine, and not sequential.
>
> I don't know how this matches with the previously posted method, as I missed
> that posting, and I don't know how well it will actually work in the real
> world. So I give no guarantees, but anyone is welcome to apply it where they
> want ;-)
>
> --Tim
>
> Toby Dickenson <tdickenson at devmail.geminidataloggers.co.uk> wrote:
>
> >
> > "Irmen de Jong" <usenet at NOSPAM-irmen.cjb.net> wrote:
> >
> > >I don't have a better solution. If anybody has a better (Pythonic) GUID
> > >generator, I'd be very interested.
> >
> > On machines that have it, /dev/urandom may well be unique enough.
>
> As you say already, it's not platform-independant...
>
> >
> > Toby Dickenson
> > tdickenson at geminidataloggers.com
> >
More information about the Python-list
mailing list