gpt4 book ai didi

c++ - UuidCreate 和 CoCreateGuid 的区别

转载 作者:行者123 更新时间:2023-12-04 14:03:34 29 4
gpt4 key购买 nike

通过调用 UuidCreate 创建的 UUID 之间是否存在差异?和 CoCreateGuid来自 Win32 API?
文档说 CoCreateGuid 只是调用了 UuidCreate,但文档中的注释却大不相同。
只有 CoCreateGuid 专门提到了用例:

[...] absolutely unique number that you will use as a persistent identifier in a distributed environment.


而 Uuidcreate 则专注于解释不可追溯性:

[...] generates a UUID that cannot be traced to the ethernet address of the computer on which it was generated. It also cannot be associated with other UUIDs created on the same computer.


我认为差异可能只是历史性的,文档提到 UuidCreate 在过去的某个时间出于安全原因从基于 MAC 的版本 1 UUID 更改为随机不可追踪的版本 4。如果需要基于 MAC 的 UUID,则引入了 UuidCreateSequential。
如果是这样,现在 UuidCreate (RPC_S_OK, RPC_S_UUID_LOCAL_ONLY, RPC_S_UUID_NO_ADDRESS) 的返回值只是为了遗留兼容性而包含在内,并且基本上已经过时了?
有没有人了解更多?据我所知,没有区别。

最佳答案

CoCreateGuid 调用 UuidCreate .UuidCreate曾经是唯一的函数,它是一个类型 1 (mac + 日期时间) uuid。
后来,一个 child 写的软件被逮捕后,他写的是traced back to his laptop because of his MAC address , Windows Vista 更改 UuidCreate成为 类型 4 (随机)uuid。
微软添加了 UuidCreateSequential作为遗产类型 1 用户名。

For security reasons, UuidCreate was modified so that it no longer uses a machine's MAC address to generate UUIDs. UuidCreateSequential was introduced to allow creation of UUIDs using the MAC address of a machine's Ethernet card.

关于c++ - UuidCreate 和 CoCreateGuid 的区别,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/69258220/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com