Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

UUID format: 8-4-4-4-12 - Why?

Tags:

guid

uuid

format

Why are UUID's presented in the format "8-4-4-4-12" (digits)? I've had a look around for the reason but can't find the decision that calls for it.

Example of UUID formatted as hex string: 58D5E212-165B-4CA0-909B-C86B9CEE0111

like image 916
Fidel Avatar asked May 21 '12 14:05

Fidel


People also ask

What is the format of a UUID?

Format. In its canonical textual representation, the 16 octets of a UUID are represented as 32 hexadecimal (base-16) digits, displayed in five groups separated by hyphens, in the form 8-4-4-4-12 for a total of 36 characters (32 hexadecimal characters and 4 hyphens).

Why should we use UUID?

Why use a UUID? The main advantage of using UUIDs is that you can create a UUID and use it to identify something, such as a row in a database, with near certainty that the identifier will not exist in another row in your system or anyone else's.

How many digits is a UUID?

A UUID – that's short for Universally Unique IDentifier, by the way – is a 36-character alphanumeric string that can be used to identify information (such as a table row).

What is v4 UUID?

Version-4 UUIDs are randomly generated. There are over 5.3 x 1036 unique v4 UUIDs. This is the most common UUID version. Version-4, variant-1 UUIDs are used in the game Minecraft. You can use our tool to generate Minecraft UUIDs than can be used in-game. Version-4, variant-2 is called a "GUID" on Microsoft systems.


1 Answers

It's separated by time, version, clock_seq_hi, clock_seq_lo, node, as indicated in the following rfc.

From the IETF RFC4122:

4.1.2.  Layout and Byte Order     To minimize confusion about bit assignments within octets, the UUID    record definition is defined only in terms of fields that are    integral numbers of octets.  The fields are presented with the most    significant one first.     Field                  Data Type     Octet  Note                                         #     time_low               unsigned 32   0-3    The low field of the                           bit integer          timestamp     time_mid               unsigned 16   4-5    The middle field of the                           bit integer          timestamp     time_hi_and_version    unsigned 16   6-7    The high field of the                           bit integer          timestamp multiplexed                                                with the version number       clock_seq_hi_and_rese  unsigned 8    8      The high field of the    rved                   bit integer          clock sequence                                                multiplexed with the                                                variant     clock_seq_low          unsigned 8    9      The low field of the                           bit integer          clock sequence     node                   unsigned 48   10-15  The spatially unique                           bit integer          node identifier     In the absence of explicit application or presentation protocol    specification to the contrary, a UUID is encoded as a 128-bit object,    as follows:     The fields are encoded as 16 octets, with the sizes and order of the    fields defined above, and with each field encoded with the Most    Significant Byte first (known as network byte order).  Note that the    field names, particularly for multiplexed fields, follow historical    practice.     0                   1                   2                   3     0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+    |                          time_low                             |    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+    |       time_mid                |         time_hi_and_version   |    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+    |clk_seq_hi_res |  clk_seq_low  |         node (0-1)            |    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+    |                         node (2-5)                            |    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 
like image 59
Matten Avatar answered Oct 19 '22 16:10

Matten