On Sunday, 11 October 2015 at 23:16:51 UTC, holo wrote:
auto hmac_sha256(ubyte[] key, ubyte[] msg)
{
auto hmac = hmac!SHA256(key);
hmac.put(msg);
auto digest = hmac.finish;
return digest;
}
alias sign = hmac_sha256;
std.digest.hmac already contains a helper function for this:
hmac!SHA256(data, secret);
The order of arguments is this way to allow chaining with UFCS:
data.hmac!SHA256(secret);
But it seems the documentation generator can't handle ddoc
comments in templates, so unfortunately it doesn't appear in the
documentation.