这是对Version 3或5的指导的完美使用。
有五种指导:
- 1: time based version (UuidCreateSequential)
- 2: DCE Security version, with embedded POSIX UIDs
- 3: Name-based version that uses MD5 hashing
- 4: Randomly or pseudo-randomly generated version (UuidCreate)
- 5: Name-based version that uses SHA-1 hashing
第3版和第5版的设计是任意的 > 姓名,总有相同的guid地图。
想法是任意“<>><> > >>和“<>>>>>> 空间<>/em> ”,并在概念上将其储存在一个指导结构中:
"CustomersTable" + "1" -> sha1() -> Guid
"CustomersTable" + "2" -> sha1() -> Guid
您避免与> 即号”相撞:
"InvoicesTable" + "1" -> sha1() -> Guid
"InvoicesTable" + "2" -> sha1() -> Guid
具体来说,“名称空间”不是指指号,而是指指:
Namespace_Customer = {277D668B-264A-433E-9EEB-867C02C6D48D} ;
Namespace_Invoice = {D8024CFB-D6F8-4DB2-9135-96FD0A7B97AB} ;
http://www.apps.ietf.org/rfc/rfc4122.html#page-30" 给出四个预先界定的名称:
NameSpace_DNS = {6ba7b810-9dad-11d1-80b4-00c04fd430c8} ;
NameSpace_URL = {6ba7b811-9dad-11d1-80b4-00c04fd430c8} ;
NameSpace_OID = {6ba7b812-9dad-11d1-80b4-00c04fd430c8} ;
NameSpace_X500 = {6ba7b814-9dad-11d1-80b4-00c04fd430c8} ;
辩论会描述了如何将16个 has子带入指导结构。 如果您的头16位牧师是:
hex: 00010203040506070809101112131415
这些结构分为:
timeLow = 00 01 02 03
timeMid = 04 05
timeHighAndVersion = ((06 07) & 0x0FFF) | (0x5000) //high 4-bits are version, 5=SHA1, 3=MD5
clockSeqHiAndReserved = (08 & 0x3F) | 0xD0 //set high bits to 10
clockSeqLow = 09
node = 10 11 12 13 14 15
通过我的<代码>NameToGuid,管理客户和发票:
NameToGUIDA(Namespace_Customer, "1") = {7E378BDB-5BB1-5EBF-9C63-E00AC1AEEDB7}
NameToGUIDA(Namespace_Customer, "2") = {830F19D8-D5DC-5321-8CF9-D708660BE473}
NameToGUIDA(Namespace_Customer, "10") = {C052F6ED-0334-5827-B077-7F4C28B78223}
NameToGUIDA(Namespace_Invoice, "1") = {BB5408DA-B99C-5816-B144-A63CC02BB21C}
NameToGUIDA(Namespace_Invoice, "2") = {73DDD3B3-1139-50C8-9B0D-067145611346}
NameToGUIDA(Namespace_Invoice, "10") = {AE1799A8-620F-55DB-AC85-D7056B70AFB5}