Platform-independent GUID creation?
Aahz Maruch
aahz at panix.com
Sat Dec 22 10:42:32 EST 2001
In article <a01vup$p52$1 at news1.xs4all.nl>,
Irmen de Jong <usenet at NOSPAM-irmen.cjb.net> wrote:
>Aahz wrote:
>>
>> The problem is that the DCE/OSF GUID standard specifies using the MAC
>> address of the network card as part of a GUID. There isn't a portable
>> way to get that, unfortunately.
>
>I've crafted my own Guid function, and it is used heavily in Pyro
>(pyro.sourceforge.net). It uses the machine's IP address instead of
>the MAC address, and adds the Pid and some other stuff (timestamp,
>random number).
>
>I don't know the DCE standard, but I do think that my routine is
>fairly "safe", so to speak. At least it is portable across all Python
>implementations, but the machine needs to have an IP address. A
>physical MAC address is not requiered, so it should work nicely on
>modem-only machines.
Nice try. (That's partly serious, partly sarcasm.) It probably works
for limited applications, but it's definitely not a guaranteed GUID.
One of the big problems with your method is that the widespread adoption
of NAT combined with excessive use of "private" IP addresses means that
there's a lot of IP address duplication out there.
Perhaps once IPv6 becomes the global standard, your method will be
sufficient.
--
--- Aahz <*> (Copyright 2001 by aahz at pobox.com)
Hugs and backrubs -- I break Rule 6 http://www.rahul.net/aahz/
Androgynous poly kinky vanilla queer het Pythonista
Tenth Virtual Anniversary: 9 days and counting
More information about the Python-list
mailing list