On 2008-12-05, Andy Tompkins
On Tue, 2 Dec 2008 00:00:32 -0500, "Scott McMurray" said:
I'd rather know whether it was v3 or v5 somewhere more obvious than the design notes, though. If I were using v3 (MD5) uuids and switched to boost not knowing that v5 (SHA1) uuids exist, I'd likely be very confused when my code stops working with my data.
Hmm, I'd be surprised if your code stopped working.
Well, if I had some UUIDs in a database that were generated from a v3 algorithm, and I tried to look one up from the base string, but generated the UUID from the v5 algorithm, the lookup would fail. Though I have no idea whether this would be an issue in practice.
But regardless, would it be enough to add a/some member functions to uuid so that one could ask what type of uuid it was? For example:
boost::uuids::version_type v = u.version();
I think that's an excellent idea. I don't think it solves the issue, though, since I likely wouldn't think to check going from some hypothetical old C API's UuidCreateByName(&id, UUID_NAMESPACE_DNS, "www.widgets.com", 15); to id = boost::uuids::uuid::create(dns_namespace_uuid, "www.widgets.com");