import std.digest.sha : SHA1; import std.string : representation; auto hmac = HMAC!SHA1("My s3cR3T keY".representation); hmac.put("Hello, world".representation); static immutable expected = [ 130, 32, 235, 44, 208, 141, 150, 232, 211, 214, 162, 195, 188, 127, 52, 89, 100, 68, 90, 216]; assert(hmac.finish() == expected);
Constructs the HMAC digest using the specified secret.