The ability to distinguish GUIDs from random data can be useful when debugging hidden code defects.
On Windows, each GUID created has version 4, so it has "4" as the first nibble of the third part. Therefore, if a 16-byte sequence violates this rule, it is not GUID version 4. For example,
567E1ECB-EA1C-42D3-A3ED-87A5D824D167
may be either version 4 GUID or something else, but
567E1ECB-EA1C-02D3-A3ED-87A5D824D167 //third section starts with 0, not with 4
not a GUID version 4.
What other signs of a 16-byte memory block are or are not a valid GUID?
debugging undefined-behavior guid random
sharptooth Nov 20 '09 at 15:55 2009-11-20 15:55
source share