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

前端 未结 3 2048
花落未央
花落未央 2020-12-08 03:59

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 UU

3条回答
  •  谎友^
    谎友^ (楼主)
    2020-12-08 04:22

    The format is defined in IETF RFC4122 in section 3. The output format is defined where it says "UUID = ..."

    3.- Namespace Registration Template

    Namespace ID: UUID Registration Information: Registration date: 2003-10-01

    Declared registrant of the namespace: JTC 1/SC6 (ASN.1 Rapporteur Group)

    Declaration of syntactic structure: A UUID is an identifier that is unique across both space and time, with respect to the space of all UUIDs. Since a UUID is a fixed size and contains a time field, it is possible for values to rollover (around A.D. 3400, depending on the specific algorithm used). A UUID can be used for multiple purposes, from tagging objects with an extremely short lifetime, to reliably identifying very persistent objects across a network.

      The internal representation of a UUID is a specific sequence of
      bits in memory, as described in Section 4.  To accurately
      represent a UUID as a URN, it is necessary to convert the bit
      sequence to a string representation.
    
      Each field is treated as an integer and has its value printed as a
      zero-filled hexadecimal digit string with the most significant
      digit first.  The hexadecimal values "a" through "f" are output as
      lower case characters and are case insensitive on input.
    
      The formal definition of the UUID string representation is
      provided by the following ABNF [7]:
    
      UUID                   = time-low "-" time-mid "-"
                               time-high-and-version "-"
                               clock-seq-and-reserved
                               clock-seq-low "-" node
      time-low               = 4hexOctet
      time-mid               = 2hexOctet
      time-high-and-version  = 2hexOctet
      clock-seq-and-reserved = hexOctet
      clock-seq-low          = hexOctet
      node                   = 6hexOctet
      hexOctet               = hexDigit hexDigit
      hexDigit =
            "0" / "1" / "2" / "3" / "4" / "5" / "6" / "7" / "8" / "9" /
            "a" / "b" / "c" / "d" / "e" / "f" /
            "A" / "B" / "C" / "D" / "E" / "F"
    

提交回复
热议问题