Function parseDAuthHash

Parses a string that was encoded by Hash.toString.

Only OO-style digests are used since the digest is specified in the string and therefore only known at runtime.

Throws ConvException if the string is malformed.

To support additional digests besides the built-in (Phobos's CRC32, MD5, RIPEMD160 and SHA), supply a custom delegate for digestFromDAuthCode. You can defer to DAuth's defaultDigestFromCode to handle the built-in digests.

Similarly, to extend crypt(3)-style to support additional digests beyond DAuth's crypt(3) support, supply a custom delegate for digestFromCryptCode. The default implementation is defaultDigestFromCryptCode.


Hash!(std.digest.digest.Digest) parseDAuthHash(
  string str,
  std.digest.digest.Digest delegate(string) digestFromDAuthCode


import std.digest.digest;
import dauth;

struct BBQ42 {...}
static assert(isDigest!BBQ42);
alias BBQ42Digest = WrapperDigest!BBQ42;

Digest customDigestFromCode(string digestCode)
    case "BBQ42": return new BBQ42Digest();
    case "FAQ17": return new FAQ17Digest();
        return defaultDigestFromCode(digestCode);

void doStuff(string hashString)
    auto hash = parseHash(hashString, &customDigestFromCode);

Optional Params

digestFromDAuthCode - Default value is 'toDelegate(&defaultDigestFromCode)'

digestFromCryptCode - Default value is 'toDelegate(&defaultDigestFromCryptCode)'