}
/*
- * s must point to enough space
+ * s must point to enough space, i.e. at least 37 bytes.
+ * this is constrained enough that sprintf could
+ * probably be avoided
*/
char *pd_uuid_get_string(pd_uuid_t *uuid, char *s) {
char *r;
return s;
}
+/*
+ * might be faster to sscanf in four bytes at a time
+ * and using htonl()
+ * A nybble loop might be faster yet.
+ */
int pd_uuid_set_string(pd_uuid_t *uuid, char *s) {
unsigned int byte;
int i;
str_ok(&uuid, "622e4fa5-7481-57ed-9c91-19e1ba69bf88", "set from hash");
pd_uuid_make_v3(0, &uuid, &pd_uuid_ns_dns, "www.widgets.com", strlen("www.widgets.com"));
- str_ok(&uuid, "3d813cbb-47fb-32ba-91df-831e1593ac29", "md5 dns");
+ str_ok(&uuid, "3d813cbb-47fb-32ba-91df-831e1593ac29", "md5 widgets dns");
pd_uuid_make_v5(0, &uuid, &pd_uuid_ns_dns, "www.widgets.com", strlen("www.widgets.com"));
- str_ok(&uuid, "21f7f8de-8051-5b89-8680-0195ef798b6a", "md5 dns");
+ str_ok(&uuid, "21f7f8de-8051-5b89-8680-0195ef798b6a", "sha widgets dns");
pd_uuid_rng_get_bytes(hash, 5);