有没有办法区分一个GUID和一个随机数? [英] Is there a way to distinguish a GUID from just a random number?
问题描述
在Windows上,每个生成的GUID都是版本4,因此它具有4 '作为第三部分的前半字节。因此,如果16字节序列违反了该规则,那么它不是版本4的GUID。例如,
567E1ECB-EA1C-42D3-A3ED-87A5D824D167
可以是版本4 GUID或其他任何东西,但
567E1ECB-EA1C-02D3-A3ED-87A5D824D167 //第三部分从0开始,而不是4
不是版本4 GUID。
16位内存块的其他符号是否为有效的GUID?
除了GUID版本(0100)之外,还有一些名为GUID的变体。这将是八位字节8中的2位(10)。v4 GUID的其余位a按照定义是随机的。
Being able to distinguish a GUID from random data can be useful when debugging obscure code defects.
On Windows each GUID generated is of version 4 therefore it has '4' as the first half-byte of the third part. So if the 16-byte sequence violtates that rule it is not a version 4 GUID. For example,
567E1ECB-EA1C-42D3-A3ED-87A5D824D167
could be either a version 4 GUID or anything else, but
567E1ECB-EA1C-02D3-A3ED-87A5D824D167 //third section starts with 0, not with 4
is not a version 4 GUID.
What are other signs of a 16-byte memory block being or not being a valid GUID?
Besides GUID version (0100), there's also something called the GUID variant. This will be 2 bits (10) in octet 8. The remaining bits a of v4 GUID are by definition random.
这篇关于有没有办法区分一个GUID和一个随机数?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!