加入收藏 | 设为首页 | 会员中心 | 我要投稿 温州站长网 (https://www.0577zz.com/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 站长学院 > MsSql教程 > 正文

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

发布时间:2021-02-01 08:14:00 所属栏目:MsSql教程 来源:网络整理
导读:如何在SQL Server中生成GUID? 我知道我应该使用newid(),但函数使用的算法是什么?它是时间/日期的哈希吗? 解决方法 创建它的算法在这里描述: http://en.wikipedia.org/wiki/Globally_Unique_Identifier Algorithm In the OSF-specified algorithm for g

如何在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

(编辑:温州站长网)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    热点阅读