gpt4 book ai didi

guid - UUID 有多独特?

转载 作者:行者123 更新时间:2023-12-03 03:56:22 24 4
gpt4 key购买 nike

使用 UUID 来唯一标识某些内容(我将其用于上传到服务器的文件)有多安全?据我了解,它是基于随机数的。然而,在我看来,只要有足够的时间,它最终会重演,纯粹是偶然。是否有更好的系统或某种类型的模式来缓解这个问题?

最佳答案

非常安全:

the annual risk of a given person being hit by a meteorite is estimated to be one chance in 17 billion, which means the probability is about 0.00000000006 (6 × 10−11), equivalent to the odds of creating a few tens of trillions of UUIDs in a year and having one duplicate. In other words, only after generating 1 billion UUIDs every second for the next 100 years, the probability of creating just one duplicate would be about 50%.

警告:

However, these probabilities only hold when the UUIDs are generated using sufficient entropy. Otherwise, the probability of duplicates could be significantly higher, since the statistical dispersion might be lower. Where unique identifiers are required for distributed applications, so that UUIDs do not clash even when data from many devices is merged, the randomness of the seeds and generators used on every device must be reliable for the life of the application. Where this is not feasible, RFC4122 recommends using a namespace variant instead.

来源:Random UUID probability of duplicates section维基百科关于通用唯一标识符的文章(链接指向 2016 年 12 月的修订版,然后编辑重新设计了该部分)。

另请参阅同一篇通用唯一标识 rune 章 Collisions 上有关同一主题的当前部分。 .

关于guid - UUID 有多独特?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1155008/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com