Is it possible for ASP.NET server to generate the same GUID for multiple users?

I've seen GUID Collisons but just wanted you to think about if there could be a GUID conflict if both clients accessed the same web page that generates the GUID at the same time (possibly down to a microsecond)?

0


source to share


5 answers


This is theoretically possible, but very unlikely.



+8


source


Not. If that happens, jump out and buy a lottery ticket!



+3


source


On one server no, this is not possible. Versions 4 Guides compose (by the way) a pseudo-random 54-bit value, and as far as I understand, they repeat all values ​​before repeating.

If you are creating on more than one server, there may be a risk of collision with the guide, although this is very unlikely.

Refer to RFC 4122 , in particular section 4.1.5. I believe modern Windows use UUID v4.

+3


source


From Wikipedia, the free encyclopedia

A globally unique identifier or GUID (pronounced / guːΙͺd / or / gwΙͺd /) is a special type of identifier used in software applications to provide a reference number that is unique in any context (hence "globally"), such as when defining an internal links for the type of access point in the software application, or for generating unique keys in the database. While each generated GUID is not guaranteed to be unique, the total number of unique keys (2128 or 3.4 Γ— 1038) is so high that the chances of the same number being generated twice is very small . For example, consider the observable universe, which contains about 5 Γ— 1022 stars; each star can have 6.8 Γ— 1015 universally unique GUIDs.

+1


source


If you create many, many GUIDs, the chance of collision becomes quite high due to the Birthday Paradox . In theory, a GUID collision should be extremely unlikely (naive intuition), but in practice it happens from time to time.

Of course, it is a waste of time to handle these collisions programmatically, but you should still write your code in such a way that in the event that this happens, your code should fail loudly and not quietly and not be detected.

+1


source







All Articles