Globally Unique Identifier

From Free net encyclopedia

(Redirected from GUID)

A Globally Unique Identifier or GUID is a pseudo-random number used in software applications. While each generated GUID is not guaranteed to be unique, the total number of unique keys (2128 or 3.4028×1038) is so large that the possibility of the same number being generated twice is very small.

GUIDs are used in many pieces of software, including Oracle Database and Novell eDirectory, but the most high-profile GUID implementation may be Microsoft's. Theirs is an implementation of a standard called Universally Unique Identifier (UUID), specified by the Open Software Foundation (OSF).

Contents

Basic structure

The GUID is a 16-byte (128-bit) number, written in hexadecimal form, such as:

3F2504E0 4F89 11D3 9A 0C 03 05 E8 2C 33 01

GUIDs are written using a four-byte word, 3 two-byte words, and a six-byte word, such as:

{3F2504E0-4F89-11D3-9A0C-0305E82C3301}

The most commonly used structure of the data type is:

GUID STRUCT
Data1 dd
Data2 dw
Data3 dw
Data4 db 8
GUID ENDS

In the Microsoft component object model, GUIDs are used to uniquely distinguish different software component interfaces. This means that two (possibly incompatible) versions of a component can have exactly the same name but still be distinguishable by their GUIDs.

GUIDs are also inserted into documents from Microsoft Office programs, as these are regarded as objects as well. Even audio or video streams in the Advanced Streaming Format (ASF) are identified by their GUIDs.

In Advanced Streaming Format (ASF) files at least, and probably in general the GUID data is stored in little endian format as a 32-bit unsigned int, followed by 2 16-bit unsigned ints, followed by 8 unsigned bytes. Software on hardware with a big endian CPU must reverse the bytes in the first 32-bit, and both 16-bit quantities, the remaining 8 bytes are fine as is. (The display format is somewhat misleading.)

Algorithm

The OSF-specified algorithm used by Microsoft for generating new GUIDs has been widely criticized. In these (V1) GUIDs, the user's network card MAC address was used as a base for the last group of GUID digits, which meant, for example, that a document could be tracked back to the computer that created it. This privacy hole was used when locating the creator of the Melissa worm.

After this was discovered, Microsoft changed the algorithm so by default it no longer contains the MAC address. V1 GUIDs which contain a MAC address can be identified by the digit "1" in the first position of the third group of digits, for example {2f1e4fc0-81fd-11da-9156-00036a0f876a}. GUIDs using the later algorithm, which has a random suffix have a "4" in the same position, for example {38a52be4-9352-453e-af97-5c3b448652f0}.

Subtypes

There are several flavors of GUIDs used in COM:

  • IID - interface identifier;
  • CLSID - class identifier;
  • LIBID - type library identifier;
  • CATID - category identifier; (its presence on a class identifies it as belonging to certain class categories)

DCOM introduces many additional GUID subtypes:

  • AppID - application identifier;
  • MID - machine identifier;
  • IPID - interface pointer identifier; (applicable to an interface engaged in RPC)
  • CID - causality identifier; (applicable to a RPC session)
  • OID - object identifier; (applicable to an object instance)
  • OXID - object exporter identifier; (applicable to an instance of the system object that performs RPC)
  • SETID - ping set identifier; (applicable to a group of objects)

These GUID subspaces may overlap, as the context of GUID usage defines its subtype. For example, there might be a class using same GUID for its CLSID as another class is using for its IID –- all without a problem. On the other hand, two classes using same CLSID couldn't co-exist.

XML syndication formats

There is also a guid tag in some versions of the RSS specification, and mandatory id tag in Atom, which should contain a unique identifier for each individual article or weblog post. In RSS the contents of the guid can be any text, and in practice is typically a copy of the post URL. Atom's IDs need to be valid URIs (usually URLs pointing to the entry, or URNs containing any other unique identifier).

External links

es:Globally Unique Identifier fr:Globally Unique Identifier he:Globally Unique Identifier hu:Globálisan egyedi azonosító ru:GUID