The globally unique identifier (guid,globally unique Identifier) is a numeric identifier generated by the algorithm with a binary length of 128 bits. GUIDs are primarily used in networks or systems that have multiple nodes, multiple computers. Ideally, no computer or computer cluster will generate two identical GUIDs. The total number of GUIDs reaches 2^128 (3.4x10^38), so the probability of randomly generating two identical GUIDs is very small, but not 0. The term GUID also sometimes refers to Microsoft's implementation of the UUID standard. Ideally, no computer or computer cluster will generate two identical GUIDs. The probability of randomly generating two identical GUIDs is very small, but not 0. Therefore, the algorithm used to generate the GUID usually adds non-random parameters (such as time) to ensure that this repetition does not occur. On the Windows platform, GUIDs are widely used in Microsoft products to identify objects such as registry keys, class and interface identities, databases, system catalogs, and so on. The format GUID is in the format "Xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", where each x is a 4-bit hexadecimal number in the range of 0-9 or a-f. For example, 6F9619FF-8B86-D011-B42D-00C04FC964FF is a valid GUID value. CharacteristicsEdit★ When a GUID is required, it can be generated automatically by the algorithm and does not require an authoritative authority to manage it. ★guid can theoretically produce the world's only value, which is convenient for future data import. DisputeEditThe potential drawbacks of the GUID values have aroused the concern of the privacy advocates. In March 1999, the U.S. Federal Commerce Commission was asked to investigate Microsoft's use of GUID values. The controversy primarily involves the use of GUID values for Office 97 and Office 2000 documents. An Office document, such as a Word file or an Excel spreadsheet, uses a GUID value that is not visible to the user. However, there are many reports that the author of the document can be traced by a trace of the GUID value, even if the author has taken a special approach, they can be traced. In response to these questions, Microsoft has released an Office 97 patch SR2, which prohibits the use of the GUID feature and can also remove the GUID of an existing document. The potential for misuse of Intel processor serial numbers is essentially the same as the problem with the above GUID values. Java
1234567891011 |
import
java.util.UUID;
public
class
guid {
/**
* @param args
*/
public static
void
main(String[] args) {
// TODO Auto-generated method stub
UUID uuid = UUID.randomUUID();
System.out.println(
".{"
+uuid.toString()+
"}"
);
}
}
|
Ocnsstring * Get_uuid () {Cfuuidref uuid_ref = cfuuidcreate (NULL); Cfstringref uuid_string_ref= cfuuidcreatestring (NULL, uuid_ref); Cfrelease (UUID_REF); NSString *uuid = [nsstringstringwithstring: (nsstring*) uuid_string_ref]; Cfrelease (uuid_string_ref); return uuid;}
GUID globally Unique identifier