UUID generator

Add to website Metainformation

Other tools

Generate UUID/GUID

Generate UUID/GUID

The Universally Unique Identifier (UUID), also known as the Globally Unique Identifier (GUID), has been widely used in computer systems.

It is a 128-bit code that is generated by the system based on variables and constants: current time, MAC address, SHA-1 hash, MD5 namespace. The end result of generating a UUID, displayed as a 32-character alphanumeric code separated by hyphens, may seem arbitrary, but in fact it is the result of complex calculations. Thus, a computer does not “invent” a code, but forms it from specific technical quantities that are relevant at a given time.

The probability that the same UUID will be generated on two different computers at different times tends to zero, which makes it possible to use the resulting codes for point/local data identification without reference to the coordination center. Today, UUID/GUID is ubiquitous in both online and offline networks, and works effectively not only in the global Internet space, but also in standalone computer systems.

UUID History

128-bit UUID codes were first used by the American company Apollo Computer in the 1980s. They were based on the simpler 64-bit codes used in Domain/OS and found widespread use in the Open Software Foundation computing environment.

With the advent of the first Windows platforms, the globally unique identifier was generalized and standardized. Microsoft adopted the DCE design from Apollo Computer and registered the URN namespace in RFC 4122. In 2005, the latter was proposed as a new standard by the IETF, and UUID was standardized within the ITU.

Earlier in 2002, system performance issues were identified when using UUIDs as primary keys in local databases. These were fixed in version 4 by adding a non-random suffix based on the computer's system time. The so-called COMB (Combined GUID Time Identifier) approach increased the risks of code duplication, but at the same time significantly improved performance when working with Microsoft SQL Server.

With the development of IT technologies, the universal unique identifier has ceased to be a highly specialized technical tool, and today everyone can use it. The probability of repetition of the generated codes is not equal to zero, but tends to it, and any digital information can be identified by them, after which they can be combined into single data arrays with minimal risks of repetition.

UUID Benefits

Generators of global unique codes do not require centralized data reconciliation/synchronization and are freely available to all users. The main advantages of UUID include:

  • Minimal risks of "collision" (repetition) of codes. Despite their massive use, the probability of repetition tends to zero.
  • Ability to join different arrays of data using UUIDs as primary (unique) keys.
  • Simplified distribution of data across multiple dispersed servers.
  • Ability to generate codes offline.

Unique identification codes, written in the format xxxxxxxx-xxxx-Mxxx-Nxxx-xxxxxxxxxxxx, allow dispersed systems to recognize information without coordination from a single data center: with an almost zero probability of errors / repetitions. This feature, along with ease of use and small requirements for computer performance, makes UUID in demand and indispensable in a wide variety of IT industries and autonomous computing systems.

Universally unique identifier

Universally unique identifier

The UUID can generate codes using different algorithms and variables/constant values.

There are 5 versions of the identifier in total, using the system date/time and MAC addresses, DCE security protocols, MD5 hash, SHA-1 hash and namespace when generated.

In all cases, the final result is displayed in the format xxxxxxxx-xxxx-Mxxx-Nxxx-xxxxxxxxxxxx (a number in hexadecimal notation, consisting of lowercase Latin letters and numbers, and divided by hyphens into five blocks: 8-4-4-4- 12), M stands for version, N stands for UUID variant.

Thus, the system uses 36 characters at a time (26 letters and 10 numbers), so the probability of repeating 32-digit codes tends to zero, despite the fact that they are generated daily by millions of users around the world.

UUID versions

Version 1

The first version of the unique identifier, when generating the code, is based on the MAC address of the computer and its system time, which changes its numerical value 1 time per second. The generation process consists of five stages:

  • The lower 32 bits of information are taken from the UTC tag. They are converted to 8 hexadecimal characters and take up 4 bytes.
  • Average 16 bits of information are taken from the same UTC label and converted into 4 hexadecimal characters occupying 2 bytes.
  • The upper 12 bits of information from the UTC tag are taken and converted to 4 more hexadecimal characters.
  • Another 1-3 bits fall on the clock sequence and reduce the risks of collisions by introducing a degree of randomness / uncertainty. The system time is either conditionally slowed down or set back - so that two or more identifiers working on the same computer at the same time do not "cross".
  • The remaining 6 bytes are a constant value generated based on the device's MAC address. It consists of 12 hexadecimal characters and is 48 bits in size.

Because the algorithm of the first version of the UUID is inextricably linked to the system time, the use of the clock sequence is mandatory. Otherwise, the risks of generating the same codes increase many times over - during the second when the system time “freezes” at one or another value.

Version 2

The second version is minimally different from the first, and is rarely used in practice. Instead of a clock sequence, it uses a system identifier tied to user data or other unique values that are not repeated on other computers or are repeated very rarely. The effect of randomness in the second version is minimized, and it can be used to improve the security of a distributed computing environment.

Versions 3 and 5

They have a lot in common: they use unique names and names (from the MD5 space) to create codes, that is, non-random values. Only version 3 uses a standard hash, while version 5 uses a SHA-1 hash. Such identifiers are less dependent on random variables.

Version 4

The generation of this UUID version is more than 90% random. It has 6 bits for constant values, and 122 for arbitrary ones. The implementation of the algorithm is that 128 bits of information are first randomly generated, and 6 of them are replaced by version and variant data.

The role of the pseudo-random number generator in the fourth version is the maximum, and if it has a too simple algorithm, the risks of repetitions/collisions increase significantly. Despite this, it is the fourth version that is by far the most common and often used in practice.

UUID options

The unique UUID has been refined several times as computer technology has developed, and today it is presented in several versions.

Option 0

Designed to work with legacy Apollo Network Computing System 1.5 1988 format databases. This option is backward compatible with them and does not conflict with NCS historical UUIDs.

Options 1 and 2

Used to identify modern data blocks and arrays, and in canonical text form they do not differ from each other, except for the order of writing the variant bits. So option 1 uses big-endian byte order, and option 2 uses title-endian. The first one is the main one, and the second one is reserved for working with early GUIDs from Microsoft Windows.

Option 3

Currently not in use. It is a reserved version for future use - when the possibilities of the previous options are exhausted.

Most systems encode the identifier in big-endian, but there are exceptions. For example, marshaling in the Microsoft COM/OLE libraries uses mixed-endian while generating code from the title-endian and big-endian blocks. The first is the first three components of the UUID, and the second is the last two.