由于GUID值产生的潜在弊端已经引起了保密性提倡者的关注。1999年3月,美国联邦商务委员会接到要求,对微软的GUID值使用进行调查。争议主要涉及Office 97和Office 2000文档对GUID值的使用。Office文档,如Word文件或Excel电子数据表,所使用的GUID值对用户是不可见的。但有很多报道宣称,文档的作者是可以通过GUID值的跟踪查到的,即使作者已经采用特殊方法,他们还是可以被追踪到。 为了回应上述问题,微软已经发布了一个Office 97修补版SR2,它禁止了GUID功能的使用,并且还可以将现存文档的GUID去除。
Java
1
2
3
4
5
6
7
8
9
10
11
|
import java.util.UUID;
public class guid {
/**
* @param args
*/
public static void main(String[] args) {
UUID uuid = UUID.randomUUID();
System.out.println( ".{" +uuid.toString()+ "}" );
}
}
|
OC
NSString * 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;
}