gpt4 book ai didi

sql-server - SQL Server 中如何生成 GUID?

转载 作者:行者123 更新时间:2023-12-04 01:09:45 34 4
gpt4 key购买 nike

SQL Server 中如何生成 GUID?

我知道我应该使用 newid() ,但是函数使用的算法是什么?它是时间/日期的哈希吗?

最佳答案

此处描述了创建它的算法:http://en.wikipedia.org/wiki/Globally_Unique_Identifier

Algorithm

In the OSF-specified algorithm for generating new (V1) GUIDs, the user's network card MAC address is used as a base for the last group of GUID digits, which means, for example, that a document can be tracked back to the computer that created it. This privacy hole was used when locating the creator of the Melissa worm[2]. Most of the other digits are based on the time while generating the GUID. V1 GUIDs which contain a MAC address and time can be identified by the digit "1" in the first position of the third group of digits, for example {2f1e4fc0-81fd-11da-9156-00036a0f876a}. V4 GUIDs use the later algorithm, which is a pseudo-random number. These have a "4" in the same position, for example {38a52be4-9352-453e-af97-5c3b448652f0}. More specifically, the 'data3' bit pattern would be 0001xxxxxxxxxxxx in the first case, and 0100xxxxxxxxxxxx in the second. Cryptanalysis of the WinAPI GUID generator shows that, since the sequence of V4 GUIDs is pseudo-random; given full knowledge of the internal state, it is possible to predict previous and subsequent values

关于sql-server - SQL Server 中如何生成 GUID?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3242287/

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