Why are binary Guids different from usual representation

断了今生、忘了曾经 提交于 2019-12-10 15:30:33

问题


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.


回答1:


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:

  • This happens independently from the DBMS or framework used
  • This depends on the processor architeture
  • This is by design

So the question remains:

Why on earth they designed it this way?



来源:https://stackoverflow.com/questions/5003061/why-are-binary-guids-different-from-usual-representation

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!