Home

 › 

Concepts

 › 

GUID: Definition, Guide, and What You Need to Know

GUID

GUID: Definition, Guide, and What You Need to Know

What is GUID?: Complete Explanation

In the computer science field, data is found in a great abundance. There is so much data tracking and recording that quite often the same data can be present within a single database. As you might imagine, identical data or duplications of data can be problematic for effective programming as data fields may be easily mistaken for the other.

To manage identical or duplicate data, computer engineers and programmers started to make one field act as an identifier for a set of data. This field is generally referred to as the data ID or identifier. Unfortunately, as the population of users interacting with a database increased, the IDs used to manage the data have started to create duplications as well. This can lead to multiple users with similar or identical data in a single database which leads to mistakes that cause database users to accidentally use the modify the wrong data.

To solve the confusion of duplicate or identical data, engineers and programmers use Globally Unique Identifiers or GUIDs. These numbers are designed to lower the possibility of duplicate GUIDs to be less than the chance of a meteor hitting earth. By increasing the pool of possible GUID numbers to a massive size, there can be an assurance that every Globally Unique Identifier is, in fact, unique.

What Does a GUID Look Like?

Globally Unique Identifiers are 128-bit numbers. The basic structure looks like this: xxxxxxxx-xxxx-Mxxx-Nxxx-xxxxxxxxxxxx. Each ‘x’ stands for a number. The ‘M’ represents the version and the ‘N’ is a variant. For example, if it is written as 2087192c-4g8c-389f-bcp9-7a8a6248761f, then the version is 3.

The Five Types of GUIDs

As the GUID, or Globally Unique Identifier, is a number used to keep data separate and easy to manage, there are multiple methods to create such a number. The version referenced in the sample structure is what is used to identify how the GUID was generated. Five different versions can be used by a generator to create unique GUIDs.

GUID

GUID

Version 1: Date-Time and MAC Address

This is created by using the current date and time along with the MAC address of the device being used to access the database.

Version 2: DCE Security

This is created using DCE security. Version 2 is not officially defined in the RFC4122 documentation of GUIDs as it is considered to be a sub-version of Version 1 that makes use of minor changes to the generation of the first four bytes. Instead of using the timestamp data, the first four bytes are determined by the user’s POSIX UID or GID and the POSIX UID/GID domain.

Version 3: MD5 Hash and Namespace

This is generated by using the namespace, a fully qualified domain name, and a given name. The namespace and name are converted to bytes, concatenated, and hashed. After the bits are specified, the resulting bytes are converted into their hexadecimal form. Version 3 GUIDs are a bit special as any GUID generated from the same name in the same namespace will be identical regardless of the timestamp.

Version 4: Random

This is created by using random numbers out of the 128 bits in a GUID. 6 are reserved for special use like notating the version type and variants which leaves 122 bits that can be filled at random. Version 4 does not have to be generated in a specific manner which means any random number generator process. For the same reason, version 4 GUID should not be used for security purposes, only for identification.

Version 5: SHA Hash and Namespace

Version 5 GUIDs are identical to version 3. The only difference is that version 5 uses the SHA-1 hashing method rather than the MD5 hashing method.

GUID: An Exact Definition

GUID is an acronym that stands for Globally Unique Identifier. It is a number generated to help keep data in a database uniquely manageable without mistaken identical or duplicate data. In most cases, a GUID is computed by Windows and Windows applications. It is a 128-bit number meant to be used to identify user accounts, documents, software, hardware, database entries, sessions, and every other form of data that needs to be uniquely managed.

For example, you may be familiar with website cookies. These cookies are handed out to everyone who visits a webpage that uses them to enhance the functionality of the site and user experience. To keep your experience separate from others, the website can generate a GUID and assign it to your browser for keeping records and tracking sessions.

GUIDs are sometimes also referred to as Universally Unique Identifiers (UUID). These terms are synonymous and interchangeable.

Here are some common use cases for GUIDs/UUIDs:

  • Creating a unique primary key in databases
  • Creating a unique filename for uploaded files
  • Creating a unique name for system resources
  • Creating and registering unique IDs without the need for contacting a central authority

All GUIDs follow a specific structure that is defined in the RFC 4122 documentation through multiple formats. All variants and versions of GUIDs/UUIDs have the same structure as described in the previous section.

Hard disk drive

GUID in blue

How Does a GUID Work?

GUIDs/UUIDs are 128-bit numbers that used to be unique identifiers, as stated in the name, to keep track of data that can be easily mistaken for identical or duplicate data. Without it, data changes can be applied to identical sets of data that are unrelated to the specific task required which can in turn cause functional issues for software.

By creating a unique number, important Windows applications and other processes can make accurate changes when necessary without breaking other software functions.

How Do You Create a GUID?

Creating these is relatively easy and has been automated through the use of one any of the multitude of online GUID generators like guidgenerator.com. There are also libraries that can be used by programmers in most programming languages such as C#, PHP, Ruby, and Python. Unfortunately, not all programming languages have access to libraries for creating GUIDs. Meaning in C programming, programmers have to either reference outside of C to compatible libraries or create a GUID function.

Anyone with experience in creating random number generators can recognize the difficulty of this problem. Meaning in C, it may be better to create a GUID class with functions based on the RFC 4122 document or just to use an online generator.

GUID Generators

There are countless GUID/UUID generators available for free use online. Here’s a short list to get you started:

  • https://www.guidgenerator.com/
  • https://www.uuidgenerator.net/guid
  • https://www.guidgen.com/
  • https://url-decode.com/tool/guid-generator
  • https://textcleaner.net/guid-generator/
  • https://www.newguid.org/

Where Did GUID Originate From?

GUIDs/UUIDs were created to circumvent duplication and identical data errors by the Open Software Foundation (OSF) and outlined in the RFC 4122 document published in July 2005. Since then, UUIDs/GUIDs are standardized IDs used as part of the Distributed Computing Environment (DCE).

Before GUIDs, datasets were identified by a single ID generated from the dataset. Unfortunately, multiple Windows applications and other programs use the same or similar data to manage functionality. Over time, this caused confusion and mistakes to take place as the wrong data would be changed or used for applications. The need for unique IDs grew to a point that the OSF decided that a standardized method needed to be created and put in place to improve future programming efforts for programmers and engineers.

What Are the Applications of a GUID?

Windows Applications

UUIDs used within the Windows Operating System are referred to as GUIDs. Every single action or process that occurs on Windows uses the same system data. Without a method to identify what data should be used and where to use it, changes can be made that stop processes from functioning properly.

To keep access and changes to data separate from other processes, GUIDs are assigned to each Windows application.

Browser Session Tracking

Websites and even the web browsers themselves use GUIDs/UUIDs to personally manage website visits to the user experience. This helps to keep form data that needs to be repeatedly accessed for custom experiences attached to specific website users.

Managing Databases

The more data or object types stored in a table or dataset, the harder it is to keep track of which field should be adjusted or changed. To help keep the data in a table organized and accurately managed, GUIDs can be used to create unique IDs.

Examples of GUID in the Real World

GUIDs are used across the board when it comes to computer formats and applications. Unique combinations of 128-bit numbers help engineers to program essential functionality without causing issues with other software accessing the same information or identical databases. Every Windows application uses GUIDs to manage stored data. Web browsers use UUIDs/GUIDs to manage individual website access and form information.

Any time data has a high possibility of duplication, GUIDs help to track which dataset goes with what process.

Next Up…

Frequently Asked Questions

What is a GUID?

GUID stands for Globally Unique Identifier. It is a unique 128-bit number organized in a format defined by the RFC 4122 document. The use of such a large number lowers the possibility that the GUID remains unique.

How do you define a GUID?

The GUID format is defined by the RFC 4122 document which details four of the five possible versions a GUID can be created from.

How do you read a GUID?

All GUIDs are created using the same structure and format. The GUID number should be structured as follows: xxxxxxxx-xxxx-Mxxx-Nxxx-xxxxxxxxxxxx. The ‘M’ variable denotes the version of GUID used to generate the ID. The ‘N’ variable refers to the variant of the version used.

What is the function of GUID?

GUIDs are used to give users or data unique identifiers to ease data management and access for applications that have multitudes of users and transactions with the possibility of duplicate or identical information. This allows users to quickly access and performs actions through databases, websites, applications, and just about every other widely accessed function without needing to involve system administration.

What is the structure of a GUID?

GUIDs are formatted under the guidelines defined in the RFC 4122 document published by the Open Source Foundation. While every GUID is a unique combination of 128-bit numbers or should be, the structure is always the same. It looks like this: xxxxxxxx-xxxx-Mxxx-Nxxx-xxxxxxxxxxxx where ‘M’ denotes the version and ‘N’ denotes the variant of the version used.

How do I create a GUID?

GUIDs can be easily created by anyone using an online GUID generator. Many programming languages have libraries that can be used to create GUIDs within your code. Some languages do not have access to these libraries such as C. Meaning in C, a custom function needs to be created to create a GUID.

How many GUID combinations are there?

The amount of possible combinations of GUIDs/UUIDs is so enormous that there are more possible combinations of GUIDs than there are grains of sand on planet Earth. To be more accurate, GUIDs are made from 128-bits. 2 bits are used for the variant and 4 bits are used for the version. That leaves 122 bits to be used to calculate a unique number. To calculate the number of combinations, use 2^122. That equals 5,316,911,983,139,663,491,615,228,241,121,400,000 possible combinations.

How large is a GUID?

A GUID is a 128-bits number.

What is the difference between a GUID and a UUID?

For the most part, GUIDs and UUIDs are synonymous and interchangeable terms. However, GUID is a designation specifically created and used by Microsoft while UUID is the open-source version. It’s important to note that there may be small differences in how the numbers are calculated, but they are the same thing.

To top