有没有办法区分一个GUID和一个随机数? [英] Is there a way to distinguish a GUID from just a random number?

查看:185
本文介绍了有没有办法区分一个GUID和一个随机数?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



在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屋!

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