我正在尝试生成一个v5 UUID,参考的函数是(http://www.ietf.org/rfc/rfc4122.txt):
/* uuid_create_sha1_from_name -- create a version 5 (SHA-1) UUID
using a "name" from a "name space" */
void uuid_create_sha1_from_name(
uuid_t *uuid, /* resulting UUID */
uuid_t nsid, /* UUID of the namespace */
void *name, /* the name from which to generate a UUID */
int namelen /* the length of the name */
);
我已经阅读了帮助文档,但我仍然不清楚上述函数的第二个参数(
uuid_t nsid
)和第三个参数(void *name
)之间有什么区别?
能否用一个例子来解释一下上述问题?
我还想了解RFC4122链接中下面的内容是什么意思,它对第二个参数有什么重要性吗?
/* Name string is a URL */
uuid_t NameSpace_URL = { /* 6ba7b811-9dad-11d1-80b4-00c04fd430c8 */
0x6ba7b811,
0x9dad,
0x11d1,
0x80, 0xb4, 0x00, 0xc0, 0x4f, 0xd4, 0x30, 0xc8
};