为什么第4版GUID的第17位数字仅限于4种可能性? [英] Why is the 17th digit of version 4 GUIDs limited to only 4 possibilities?

查看:134
本文介绍了为什么第4版GUID的第17位数字仅限于4种可能性?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我了解到,这并不会从所涉及的熵中获得很大的收益,即使保留了GUID的整个特征(出于任何目的),我们仍然有足够的余量供每只昆虫使用有一个,所以我不担心,只是好奇.

I understand that this doesn't take a significant chunk off of the entropy involved, and that even if a whole nother character of the GUID was reserved (for any purpose), we still would have more than enough for every insect to have one, so I'm not worried, just curious.

这个好答案所示,

As this great answer shows, the Version 4 algorithm for generating GUIDs has the following format:

xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx

  1. x是随机的
  2. 4是常量,表示版本号.
  3. y是以下其中一项:8、9,A或B

UUID的RFC规范指出,必须对此位进行设置方式,但我看不出任何原因.

The RFC spec for UUIDs says that these bits must be set this way, but I don't see any reason given.

为什么第三个项目符号(第17个数字)仅限于这四个数字?

Why is the third bullet (the 17th digit) limited to only those four digits?

推荐答案

引用可估计的利珀特先生

Quoting the estimable Mr. Lippert

首先,当我们说比特"时,我们在谈论什么比特?我们已经知道,在随机" GUID中,第三部分的第一个十六进制数字始终为4.....在第四部分的位中,GUID中还存储有其他版本信息;您会注意到,GUID几乎总是以8、9,a或b作为第四部分的第一个十六进制数字.因此,总共有6位保留给版本信息,剩下122位可以随机选择.

First off, what bits are we talking about when we say "the bits"? We already know that in a "random" GUID the first hex digit of the third section is always 4....there is additional version information stored in the GUID in the bits in the fourth section as well; you’ll note that a GUID almost always has 8, 9, a or b as the first hex digit of the fourth section. So in total we have six bits reserved for version information, leaving 122 bits that can be chosen at random.

(来自 https://ericlippert.com /2012/05/07/guid-guide-part-three/)

tl; dr-有关更多版本信息.要获得比我怀疑的更为具体的信息,您将不得不跟踪该规范的作者.

tl;dr - it's more version information. To get more specific than that I suspect you're going to have to track down the author of the spec.

这篇关于为什么第4版GUID的第17位数字仅限于4种可能性?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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