A universally unique identifier (UUID) is a 128-bit number used to identify information in computer systems. The term globally unique identifier (GUID) is also used.
UUID Version:
There are five versions of UUIDs, and the one we use most often is the fourth version, which is based on random or pseudo-random numbers.
v1: Based on time UUID is based on MAC address and timestamp
Generated based on current timestamp and machine MAC address; Because the MAC address is used in the algorithm, the UUID can be guaranteed to be unique globally. But at the same time, because it exposes the MAC address of the computer and the time when the UUID is generated, it can be deduced and predicted reversely, so it is not recommended.
v2: DCE security UUID
Deprecated, the same as the time-based UUID algorithm, but the first 4 bits of the timestamp are replaced by POSIX UID or GID. However, it is not explicitly specified in the UUID specification, so basically all UUID implementations will not implement this version.
v3: MD5 hash value based on name space
The user specifies 1 namespace and 1 specific string to generate 1 UUID through MD5 hash. According to the specification description, the existence of this version is for backward compatibility, and it is rarely used in peacetime.
v4: UUID based on random number
Generate UUID based on random number or pseudo-random number. This version is the most commonly used version.
v5: SHA-1 hash value based on name space
The same as v3, but the hash function is changed to SHA1.