A Universally Unique Identifier (UUID) is a 128-bit identifier used to uniquely identify information in computer systems. When generated using standard methods, UUIDs exhibit uniqueness in practical applications and do not rely on central registration and allocation authorities. The probability of UUID duplication is close to zero and can be considered negligible.
As a result, anyone can create and use UUIDs independently, and it is almost certain that they will not collide with existing identifiers. Because of this, UUIDs generated in different locations can be used in the same database or channel, with minimal risk of duplication.
The format of a UUID is as follows: xxxxxxxx-xxxx-Mxxx-Nxxx-xxxxxxxxxxxx. N can only be 8, 9, a, or b. M represents the version number, and since UUID's standard implementation has five versions, it will be one of 1, 2, 3, 4, or 5.
Generated based on the current timestamp and machine MAC address. This version ensures global uniqueness due to the use of MAC addresses in the algorithm. However, it exposes the computer's MAC address and the time of UUID generation, making it a criticized aspect of this UUID version.
DCE Security UUID shares the algorithm with the time-based UUID but replaces the first 4 positions of the timestamp with POSIX UID or GID. However, the UUID specification does not explicitly define this version, so most UUID implementations do not support it.
User-specified namespace and a specific string are used to generate a UUID through MD5 hashing. According to the specification, this version exists for backward compatibility and is rarely used in practice.
UUID generated based on random or pseudo-random numbers. This version is the most commonly used.
Similar to Version 3, but the hashing function is replaced with SHA1.