This article is a mirror article of machine translation, please click here to jump to the original article.

View: 2148|Reply: 0

What is a UUID? and the difference between versions

[Copy link]
Posted on 2024-10-18 16:31:13 | | |
Requirements: Find a UUID generator and find that UUIDs are also version-differentiated.

What is a UUID?

The Universally Unique Identifier (UUID) is a 128-digit identifier used to uniquely identify a piece of information in the system.

According to the standard (RFC 4122 (opens new window)), UUIDs are generated without relying on external services and are unique (note: the probability of duplication is almost zero).

UUIDs are made up of 32 numbers in hexadecimal, so the theoretical total is 16^32, and even if one trillion are generated per nanosecond, it will take ten billion years to use up all UUIDs.

In its canonical text representation, the UUID's 16 8-bit bytes are represented as 32 hexadecimal numbers, separated by the hyphen '-' displayed in five groups in the form "8-4-4-4-12" for a total of 36 characters (32 hexadecimal numbers and 4 hyphens).

For example:

123e4567-e89b-12d3-a456-426655440000
xxxxxxxx-xxxx-Mxxx-Nxxx-xxxxxxxxxxxx

UUID version

  • v1- Version 1 UUID uses timestamps and monotonic counters.
  • v3 - Version 3 UUID based on MD5 hashes of some data.
  • v4 - Version 4 UUID with random data.
  • v5- Version 5 UUID based on SHA1 hashes of some data.
  • v6- Version 6 UUID uses timestamps and monotonic counters.
  • v7 - Version 7 UUID with Unix timestamps.
  • v8 - Version 8 UUID with user-defined data.


Which UUID version should I use?

If you only want to generate unique identifiers, consider version 4 (v4) UUIDs. If you want to use UUIDs as database keys or need to sort them, consider version 7 (v7) UUIDs. Other versions should generally be avoided unless there is an existing demand.

Some UUID versions supersede others. Version 6 is better than version 1, and version 5 is better than version 3.

UUID and GUID difference

Standards and implementations: UUID is an open standard, while GUID is a specific implementation of the UUID standard by Microsoft.

Reference:The hyperlink login is visible.





Previous:Angular 18 series (twenty-five) dynamically inserts rendered HTML code
Next:Major, Minor, Build Number, and Revision version numbers are annotated
Disclaimer:
All software, programming materials or articles published by Code Farmer Network are only for learning and research purposes; The above content shall not be used for commercial or illegal purposes, otherwise, users shall bear all consequences. The information on this site comes from the Internet, and copyright disputes have nothing to do with this site. You must completely delete the above content from your computer within 24 hours of downloading. If you like the program, please support genuine software, purchase registration, and get better genuine services. If there is any infringement, please contact us by email.

Mail To:help@itsvse.com