md5UUID

This function generates a name based (Version 3) UUID from a namespace UUID and a name. If no namespace UUID was passed, the empty UUID UUID.init is used.

Note: The default namespaces (dnsNamespace, ...) defined by this module should be used when appropriate.

RFC 4122 recommends to use Version 5 UUIDs (SHA-1) instead of Version 3 UUIDs (MD5) for new applications.

CTFE: CTFE is not supported.

Note: RFC 4122 isn't very clear on how UUIDs should be generated from names. It is possible that different implementations return different UUIDs for the same input, so be warned. The implementation for UTF-8 strings and byte arrays used by std.uuid is compatible with Boost's implementation. std.uuid guarantees that the same input to this function will generate the same output at any time, on any system (this especially means endianness doesn't matter).

Note: This function does not provide overloads for wstring and dstring, as there's no clear answer on how that should be implemented. It could be argued, that string, wstring and dstring input should have the same output, but that wouldn't be compatible with Boost, which generates different output for strings and wstrings. It's always possible to pass wstrings and dstrings by using the ubyte[] function overload (but be aware of endianness issues!).

  1. UUID md5UUID(const(char[]) name, UUID namespace)
    @safe pure nothrow @nogc
    md5UUID
    (
    const(char[]) name
    ,)
  2. UUID md5UUID(const(ubyte[]) data, UUID namespace)

Examples

//Use default UUID.init namespace
auto simpleID = md5UUID("test.uuid.any.string");

//use a name-based id as namespace
auto namespace = md5UUID("my.app");
auto id = md5UUID("some-description", namespace);

Meta