By Vangie Beal
A Globally Unique Identifier (GUID) is a unique ID that is computed by Windows and Windows applications. It’s a 128-bit number used to identify user accounts, documents, software, hardware, database entries, sessions, and other items. For example, a website may generate a GUID and assign it to a user’s browser to record and track the session.
GUID may also be referred to as a Universally Unique Identifier (UUID). The two terms are synonymous. GUIDs can be used for:
- Setting a unique primary key in databases
- Setting a unique filename for uploaded files
- Setting a unique name for resources
- Creating and registering unique IDs without contacting a central authority
A GUID follows a specific structure defined in RFC 4122 and comes in multiple formats. However, all variants follows the same structure:
M represents the version. N represents the variant.
Types of GUIDs
The general types of GUIDs include:
- Random: Uses a system to generate a random, 128-bit number
- Time-based: Creates a GUID based on the current time
- Hardware-based: Makes a GUID with certain portions based on hardware features, such as the MAC address of a network card.
- Content-based (MD5 or SHA-1 hash of data): Creates a GUID based on a hash of the file contents. Files with the same contents will be assigned the same GUID.
Creating a GUID