LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   GUIDs (https://www.linuxquestions.org/questions/programming-9/guids-157040/)

sikil_nuru 03-13-2004 05:41 AM

GUIDs
 
How do i create Globally Unique IDentifiers?
Ei a number that will never be generated on another machine ever again.
Doesn't it involve using the CPU-ID?

Hko 03-13-2004 06:04 PM

In what programming language?

You could use tha MAC address(es), if the computer has a network card, an if that's strong enough for you as an identifier.

sikil_nuru 03-14-2004 07:43 AM

C++ and/or assembler. Im writing a 3D-engine in wich the users can
create ther own mods/levels/what-ever and instead of using the name
of the plugin like Unreal and Quake does wich causes name collisions
(how do i know that a guy on the other side of the planet isn't using
this name?). No i can't use MAC-addresses cause i want my engine to
run even if the computer isn't network-connected :( . I know that with
DirectX (i tried it, but prefer OpenGL) comes a program that generats
GUIDs, how does it work?

Hko 03-14-2004 08:17 AM

The only thing I could think of is using as much as possible system specific information from /proc. You could make one string of all info concatenated, and maybe generate an MD5 sum from it.

deiussum 03-14-2004 09:17 AM

If you are talking about the MS GUID generator, it works by using a combination of MAC address, timestamp, and a random number. For computers without a MAC address, it uses an alternate method. In Windows, there are various libraries that can be used to generate a GUID. I don't know of any libraries offhand that do so for Linux, but if you search around, you may be able to find something.

Here's a link to the code for Microsoft's GUIDGEN app. I haven't looked at it at all, so it maybe just calls their APIs to get the GUID, which probably wouldn't be much help to you.

http://msdn.microsoft.com/library/de...fc_guidgen.asp

Hko 03-16-2004 03:22 PM

Does this help?

man uuidgen


All times are GMT -5. The time now is 05:38 AM.