I have the following Guid:
AAB13E97-449B-4D5B-BDE2-AC479C31B782
Using System.Guid + DbLinq + SQLite to store it the following field is added to the database.
973EB1AA-9B44-5B4D-BDE2-AC479C31B782
(Dashes added for clarity)
I can see that the last 8 bytes are in the same order, and the 3 first groups are reversed, but I don't understand why.
The GUID designation is an industry standard defined by Microsoft to provide a reference number which is unique in any context. UUID is a term that stands for Universal Unique Identifier. Similarly, GUID stands for Globally Unique Identifier. So basically, two terms for the same thing.
A GUID is a unique number that can be used as an identifier for anything in the universe, but unlike ISBN there is no central authority - the uniqueness of a GUID relies on the algorthm that was used to generate it.
All GUIDs must be authored in uppercase. The valid format for a GUID is {XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX} where X is a hex digit (0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F). Note that utilities such as GUIDGEN can generate GUIDs containing lowercase letters.
The GUID is really just a number. The hyphens show you how the various components are broken down but aren't really part of the number. It's like an IP address - you can store a 32-bit number, or you can store a string with dots in it, they are equivalent. Save this answer.
Looking at Wikipedia's article on the subject it says:
Data4 stores the bytes in the same order as displayed in the GUID text encoding (see below), but the other three fields are reversed on little-endian systems (for example Intel CPUs).
So I conclude:
So the question remains:
Why on earth they designed it this way?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With