问题描述
如果我使用构造函数创建一个(比方说,的Guid = myGuid新的GUID(myguid)
),是否有较高的机会,这将与 Guid.NewGuid创建的GUID碰撞( )
对2的GUID都与 Guid.NewGuid()创建
?
If I create a GUID using the constructor (say, Guid myGuid = new Guid("myguid")
), is there a higher chance that it would collide with a GUIDs created with Guid.NewGuid()
vs. two GUIDs both created with Guid.NewGuid()
?
编辑
更具体的问题:的
推荐答案
真正的答案是它依赖。 创建它基于几个因素这里描述。如果您从 NewGuid
创建它的字符串表示,你把在构造函数中,那么机会是一样的调用 NewGuid
的两倍。
The real answer is it depends. Guid.NewGuid creates it based on several factors described here. If you take the string representation of creating it from NewGuid
and you put that in the constructor, then the chance is the same as calling NewGuid
twice.
话虽这么说,并不是所有的GUID都是平等的。不同的系统有产生它们的方式不同,并且它们可能不如碰撞作为.NET实施抗性。还有什么可说的,我不能创建一个能够被解析成不基于任何规则的GUID的字符串。此GUID将有碰撞的更大的机会。
That being said, not all GUIDs are created equal. Different systems have different ways of generating them, and they may not be as collision resistant as the .NET implementation. There is nothing to say that I couldn't create a string which could be parsed into GUIDs which isn't based on any rules. This GUID would have a much greater chance of a collision.
这篇关于是否有一个更大的机会进行比较的GUID创建不同的时发生冲突?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!