Is there a way to distinguish a GUID from just a random number?

后端 未结 2 1124

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

相关标签:
2条回答
  • 2021-01-12 18:42

    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.

    0 讨论(0)
  • 2021-01-12 18:59

    GUID's are hexadecimal, so you could check what characters are included (i.e. 'X', 'Y', etc. are not valid)

    Check wikipedia for the definition and you could probably find out more ideas there.

    http://en.wikipedia.org/wiki/Globally_Unique_Identifier

    0 讨论(0)
提交回复
热议问题