Index: base/guid.h |
diff --git a/base/guid.h b/base/guid.h |
index c0a06f8858e3637aace7ebd03287e18b095e35e4..67267043f467a0ae00a3795eff71859949f3aad3 100644 |
--- a/base/guid.h |
+++ b/base/guid.h |
@@ -14,19 +14,25 @@ |
namespace base { |
-// Generate a 128-bit random GUID of the form: "%08X-%04X-%04X-%04X-%012llX". |
+// Generate a 128-bit (pseudo) random GUID in the form of version 4 as described |
+// in RFC 4122, section 4.4. |
+// The format of GUID version 4 must be xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx, |
+// where y is one of [8, 9, A, B]. |
+// The hexadecimal values "a" through "f" are output as lower case characters. |
// If GUID generation fails an empty string is returned. |
-// The POSIX implementation uses pseudo random number generation to create |
-// the GUID. The Windows implementation uses system services. |
BASE_EXPORT std::string GenerateGUID(); |
// Returns true if the input string conforms to the GUID format. |
+// (Note that this does not strictly check version 4 format so that it accepts |
+// GUID format that was generated by Windows system services. |
+// IsValidVersion4GUID to perform stricter check.) |
BASE_EXPORT bool IsValidGUID(const std::string& guid); |
-#if defined(OS_POSIX) |
+// Returns true if the input string conforms to the version 4 GUID format. |
+BASE_EXPORT bool IsValidVersion4GUID(const std::string& guid); |
+ |
// For unit testing purposes only. Do not use outside of tests. |
BASE_EXPORT std::string RandomDataToGUIDString(const uint64_t bytes[2]); |
-#endif |
} // namespace base |