Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Quoting from the <a href="http://www.ietf.org/rfc/rfc4122.txt" rel="nofollow">UUID standard</a>:</p> <p>The structure of UUIDs is:</p> <pre> 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 </pre> <p>In the absence of explicit application or presentation protocol specification to the contrary, a UUID is encoded as a 128-bit object, as follows:</p> <p>The fields are encoded as 16 octets, with the sizes and order of the fields defined above, and with each field <strong>encoded with the Most Significant Byte first</strong> (known as network byte order). Note that the field names, particularly for multiplexed fields, follow historical practice.</p> <pre> 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) | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ </pre> <p>Quoting from the <a href="http://msdn.microsoft.com/en-us/library/3573497s.aspx" rel="nofollow">Guid documentation</a>:</p> <pre><code>public Guid(int a, short b, short c, byte[] d) Guid(1,2,3,new byte[]{0,1,2,3,4,5,6,7}) creates a Guid that corresponds to "00000001-0002-0003-0001-020304050607". </code></pre> <p>According to <a href="http://en.wikipedia.org/wiki/Endianness" rel="nofollow">Wikipedia's Endianness article</a> Windows stores <strong>numbers</strong> in little endian --> least significant byte first.</p> <p>The mapping 1,2,3,new byte[]{0,1,2,3,4,5,6,7} to "00000001-0002-0003-0001-020304050607", shows us that the numbers are displayed big-endian, as in the UUID standard, however, the byte array is provided in the same order as display - no need to swap the bytes.</p> <p>So Guids are displayed as:</p> <p>{time_low (4B) - time_mid (2B) - time_hi_and_version (2B) - clock_sq_hi_and_reserved(1B), clock_seq_low (1B) - node (6B)}</p> <p>In little endian this results in byte order (byte[] does not count as a number as is therefore :</p> <p>{3,2,1,0 - 5,4 - 7,6 - 8,9 - 10,11,12,13,14,15}</p> <p>which results in hexidecimal character order (each byte is 2 hexidecimal digits):</p> <p>{6,7,4,5,2,3,0,1 - 10,11,8,9 - 14,15,12,13 - 16,17,18,19 - 20,21,22,23,24,25,26,27,28,29,30,31}</p> <p>In Oracle, the <a href="http://www.techonthenet.com/oracle/functions/substr.php" rel="nofollow">substr string function</a> is 1-based, therefore the Oracle string indexes are:</p> <p>{7,8,5,6,3,4,1,2 - 11,12,9,10 - 15,16,13,14 - 17,18,19,20 - 21,22,23,24,25,26,27,28,29,30,31,32}</p> <p>Which results in the command</p> <pre><code>substr(HexData, 7, 2) || substr(HexData, 5, 2) || substr(HexData, 3, 2) || substr(HexData, 1, 2) || '-' || substr(HexData, 11, 2) || substr(HexData, 9, 2) || '-' || substr(HexData, 15, 2) || substr(HexData, 13, 2) || '-' || substr(HexData, 17, 4) || '-' || substr(HexData, 21, 12); </code></pre> <p>And transposed (after removing '-'s):</p> <p>{7,8,5,6,3,4,1,2, 11,12,9,10, 15,16,13,14, 17,18,19,20, 21,22,23,24,25,26,27,28,29,30,31,32} </p> <p>is reversed back into</p> <p>{1,2,3,4,5,6,7,8, 9,10,11,12, 13,14,15,16, 17,18,19,20, 21,22,23,24,25,26,27,28,29,30,31,32}</p> <p>using the same function (without adding '-'s) - converting BE to LE and LE to BE have the same swaps since the bytes are simply reversed and reversing reversed bytes results in non-reversed bytes.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload