猜出(匹配)Guid的概率是多少? [英] What is the probability of guessing (matching) a Guid?

查看:249
本文介绍了猜出(匹配)Guid的概率是多少?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

只是好奇,但是匹配Guid的概率是多少?

Just curious but what is the probability of matching a Guid?

从SQL Server说一个向导:5AC7E650-CFC3-4534-803C-E7E5BBE29B3D

Say a Guid from SQL server: 5AC7E650-CFC3-4534-803C-E7E5BBE29B3D

它是阶乘吗?:( 36 * 32)! =(1152)!

is it a factorial?: (36*32)! = (1152)!

讨论 = D

推荐答案

不清楚您要问什么.我看到两种解释您问题的方法.

It's not clear what you're asking. I see two ways to interpret your question.

  1. 给出一个GUID g,有人猜出它的概率是多少?为了简单起见,我们假定GUID的所有128位都可用.那么猜测g的概率为2^-128.太小了让我们对此有所了解.假设攻击者每秒可以生成十亿个GUID.为了有50%的机会猜测g,我们的攻击者必须生成2 ^ 127个GUID.以每秒10亿的速度,将需要5391448762278159040348年才能生成2 ^ 127个GUID.

  1. Given a GUID g, what is the probability of someone guessing it? Let's assume for simplicity that all 128 bits of a GUID are available. Then the probability of guessing g is 2^-128. That's small. Let's get some intuition around that. Let's assume that our attacker can generate one billion GUIDs per second. To have a 50% chance of guessing g, our attacker would have to generate 2^127 GUIDs. At a rate of one billion per second, it would take 5391448762278159040348 years to generate 2^127 GUIDs.

我们正在生成一个向导集合.发生碰撞的可能性有多大?也就是说,我们生成具有相同值的两个Guid的可能性是多少?这是生日悖论.如果您随机生成n个GUID序列,那么至少一次碰撞的可能性大约为p(n) = 1 - exp(-n^2 / 2 * 2^128)(这是生日问题,可能的生日数为2 ^ 128).

We are generating a collection of guids. What is the likelihood of a collision? That is, what is the likelihood that we generate two guids with the same value? This is the birthday paradox. If you generate a sequence of n GUIDs randomly, then the probability of at least one collision is approximately p(n) = 1 - exp(-n^2 / 2 * 2^128) (this is the birthday problem with the number of possible birthdays being 2^128).

n p(n) 2^30 1.69e-21 2^40 1.77e-15 2^50 1.86e-10 2^60 1.95e-03

n p(n) 2^30 1.69e-21 2^40 1.77e-15 2^50 1.86e-10 2^60 1.95e-03

因此,即使您生成2 ^ 60个GUID,发生碰撞的几率也非常小.如果您每秒可以生成十亿个GUID,则仍然需要36年才能产生1.95e-03碰撞的机会.

So, even if you generate 2^60 GUIDs, the odds of a collision are extremely small. If you can generate one billion GUIDs per second, it would still take 36 years to have a 1.95e-03 chance of a collision.

这篇关于猜出(匹配)Guid的概率是多少?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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