AWS API Dlang, hmac sha256 function.
    Marc Schütz via Digitalmars-d-learn 
    digitalmars-d-learn at puremagic.com
       
    Mon Oct 12 02:12:48 PDT 2015
    
    
  
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.
    
    
More information about the Digitalmars-d-learn
mailing list