2012-05-21 9 views
57

UUID가 "8-4-4-4-12"(숫자) 형식으로 표시되는 이유는 무엇입니까? 그 이유를 둘러 보았지만 그것을 요구하는 결정을 찾을 수는 없습니다. 16 진수 문자열로 포맷의 UUIDUUID 형식 : 8-4-4-4-12 - 이유가 무엇입니까?

예 : 58D5E212-165B-4CA0-909B-C86B9CEE0111

답변

40

followoing의 RFC에 나타낸 바와 같이, 이것은, time, version, clock_seq_hi, clock_seq_lo, node 의해 분리있다. 밝히는 출력 포맷이 정의의 형식은 제 3 절에 IETF RFC4122에 정의 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)       | 
    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 
+6

왜 타임 스탬프가 세 부분으로 나뉘 었습니까? – immibis

+3

필드 생성 방법은 UUID 버전에 따라 다릅니다. 선호하는 방법은 ID가 생성 된 시간 (잠재적 인 보안 문제)을 나타 내기 때문에 시간을 사용하지 않습니다. http://en.wikipedia.org/wiki/Universally_unique_identifier#Variants_and_versions – pmont

+0

@pmont "Preferred"? –

9

가입일

"UUID = ..."

3.- 네임 등록 템플릿

네임 스페이스 ID : UUID 등록 정보 : 등록 날짜 : 2003-10-01

JTC 1/SC6 (ASN.1 포터 기) 통사 구조

선언 : 네임 스페이스 선언 (210)

등록자 UUID는 모두에 대해 공간 및 시간 에서 고유 식별자 인 모든 UUID의 공간. UUID는 고정 된 크기이고 시간 필드를 포함하기 때문에 값을 롤오버로 지정할 수 있습니다 (특정 알고리즘 에 따라 다름, 약 3400). UUID는 수명이 매우 짧은 개체에 태그를 지정하고 네트워크 전체에서 매우 영구적 인 개체 인 을 신뢰할 수있게 식별하는 등 다양한 용도로 사용할 수 있습니다.

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"