Global Unique identifier GUID

Source: Internet
Author: User

A. Guid concept

GUID: The globally unique Identifier (globally unique identifier) is also known as the UUID (universally unique Identifier). A GUID is a 128-bit numeric identifier produced by a particular algorithm that indicates the uniqueness of the product. GUIDs are primarily used to assign identifiers that must be unique in a network or system that has multiple nodes, multiple computers, and more than one computer.

On the Windows platform, GUIDs are widely used in Microsoft products to identify objects such as registry keys, class and interface identifiers, databases, system catalogs, and so on.

Two. Guid format

The format of the GUID is "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", where each x is a 32-bit hexadecimal number in the range of 0-9 or a-f. (8-4-4-4-12) For example: 6F9619FF-8B86-D011-B42D-00C04FC964FF is a valid GUID value.

Three. Guid Features

The 1.GUID is unique in space and time, ensuring that the numbers produced at different places at the same time are different.
2. No two computers in the world will generate duplicate GUID values.
3. When a GUID is required, it can be automatically generated by the algorithm and does not require an authoritative authority to manage it.
The 4.GUID is fixed in length and relatively short, and is ideal for sorting, labeling, and storage.

Four. Guid pros and cons

1. Advantages

Compared to the IDENTITY column, the uniqueidentifier column can know the new row ID in advance with the NewID () function, which provides great convenience for subsequent processing of the application.

Easy to migrate databases, other databases do not necessarily have an IDENTITY column, and GUID columns can be converted to other databases as character columns, while storing the GUID values generated in the application into the database, it does not affect the original data.

Easy to initialize the database, if the application to load some initial data, the IDENTITY column processing is more cumbersome, and the uniqueidentifier column without any processing, directly loaded with T-SQL.

It facilitates the permanent identification of certain objects or constants, such as ClassID of classes, instance identities of objects, contacts in UDDI, service interfaces, tmodel identity definitions, and so on.
2) Disadvantages

The GUID value is longer, not easy to remember and input, and this value is random, no order, so use to pay attention to the occasion, it is best not to try to use it as your e-mail address J

The GUID has a value of 16 bytes, which is relatively large compared to other integers such as 4 bytes. This means that if you use the uniqueidentifier key in your database, you may have two negative effects: increased storage space and slower indexing time.

Five. Guid controversy

        The potential drawbacks of GUID values have attracted the attention of privacy advocates. In March 1999, the U.S. Federal Commerce Commission was asked to investigate Microsoft's use of GUID values. The controversy mainly concerns the use of office 97 and office 2000 documents for GUID values. An Office document, such as a Word file or an Excel spreadsheet, uses a GUID value that is not visible to the user. However, there are many reports that the author of the document can be traced by a trace of the GUID value, even if the author has taken a special approach, they can be traced.   In response to the above questions, Microsoft has released a office 97 patch SR2, which prohibits the use of the GUID feature and also removes the GUID of the existing document.   
      Potential misuse of Intel processor serial numbers is essentially the same as the problem with the above GUID values.

In the API parameters, it is often not the real name of the class or dll/exe file that needs to be given, but rather the use of their GUID (Global uniform ID). The GUID is Microsoft's interpretation of the UUID (uniform unique identity), which is theoretically unique throughout the space and time dimension, so using a GUID instead of the real name can prevent confusion with two objects of the same name in the system.
A GUID is a 128-bit long (16-byte) number, shaped like xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx. The first 4 bytes are random, and 5-8 bytes is a timestamp, which records the generation time from 1490 onwards to the GUID (low 16 bits in front, in minutes), thus guaranteeing the unique time; 9-10 bytes related to machine restart times The last 6 bytes are usually the address of the machine's network card (if the machine does not have a network card, another constant is used), thus guaranteeing the uniqueness of the space.
In the system, the GUID is saved under the HKEY_CLASSES_ROOT key for the registry (running →regedit). HKEY_CLASSES_ROOT is actually the hkey_local_machine\software\classes\ shortcut key, there are many long strings named children, these strings are GUIDs. The GUID under HKEY_CLASSES_ROOT is divided into 4 parts:

1. Program ID

such as Access.Application, where Access represents the Dll/exe file name where the class resides, application is the name of the class. Although the program ID is easier to use than the class ID, it can cause confusion because it is not necessarily unique. Programmers can only use program IDs in VB and vj++, but the two languages allow the program ID to be up to 39 characters, so you can take a program ID exactly the same as the GUID, guaranteeing that the program ID is also unique.


All class IDs registered on the machine are listed under this subkey. Under each GUID key. You can find all the information about this class ID. If the class ID corresponds to a DLL, the DLL file name is under the InprocServer32 subkey, and if it is a local EXE program, the file name is under the LocalServer32 subkey, and if it is a remote EXE, there is a AppID subkey that points to the AppID key entry.

3. AppID

The startup parameters for each remote Dll/exe are listed under this subkey, including object location, file name, and so on.


The GUID of all registered classes in the local system is listed under this subkey. In each of these GUID keys, the class ID of the proxy is saved, and the ID is used to pass in the outgoing parameter when the other application communicates with it.


A GUID (global uniform identifier) is a number generated on a machine that guarantees that all machines in the same time and space are unique. Typically, the platform provides the API to generate the GUID. The generation algorithm is interesting, using the Ethernet card address, nanosecond time, chip ID code and many possible numbers. The only drawback to the GUID is that the resulting string will be larger. ”

1. A GUID is a 128-bit integer (16 bytes), and in the case of a unique identifier, you can use this integer between all computers and networks.

2. The format of the GUID is "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", where each x is a hexadecimal number in the range of 0-9 or a-f. For example, 337C7F2B-7A34-4F50-9141-BAB9E6478CC8 is a valid GUID value.

3. Duplicate GUID values are not generated by any two computers in the world. GUIDs are primarily used to assign identifiers that must be unique in a network or system that has multiple nodes, multiple computers, and more than one computer.

4. On the Windows platform, GUIDs are widely used: Registry, class and interface identifiers, databases, even automatically generated machine names, directory names, and so on.

Global Unique identifier GUID

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.