GUID碰撞可能吗? [英] Are GUID collisions possible?

查看:71
本文介绍了GUID碰撞可能吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用SQL Server 2000中的一个数据库,该数据库为每个使用与其绑定的应用程序的用户使用GUID.不知何故,两个用户最终获得了相同的GUID.我知道微软使用一种算法来生成随机GUID,该GUID引起碰撞的可能性极低,但是仍然可能发生碰撞吗?

I'm working on a database in SQL Server 2000 that uses a GUID for each user that uses the app it's tied to. Somehow, two users ended up with the same GUID. I know that microsoft uses an algorithm to generate a random GUID that has an extremely low chance of causing collisons, but is a collision still possible?

推荐答案

基本上没有.我认为有人在破坏您的数据库.根据使用的GUID版本,该值是唯一的(对于版本1 GUID而言),或者是唯一且不可预测的(对于版本4 GUID而言). SQL Server的NEWID()函数实现似乎使用了128位随机数,因此不会发生冲突.

Basically, no. I think someone went mucking with your database. Depending on the version GUID you're using the value is either unique (for things like version 1 GUIDs), or both unique and unpredictable (for things like version 4 GUIDs). SQL Server's implementation for their NEWID() function appears to use a 128-bit random number, so you're not going to get a collision.

要产生1%的碰撞机会,您需要生成大约 2,600,000,000,000,000,000 GUID.

For a 1% chance of collision, you'd need to generate about 2,600,000,000,000,000,000 GUIDs.

这篇关于GUID碰撞可能吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆