View source code
Display the source code in std/digest/hmac.d from which this page was generated on github.
Report a bug
If you spot a problem with this page, click here to create a Bugzilla issue.
Improve this page
Quickly fork, edit online, and submit a pull request for this page. Requires a signed-in GitHub account. This works well for small changes. If you'd like to make larger changes you may want to consider using local clone.

Function std.digest.hmac.HMAC.this

Constructs the HMAC digest using the specified secret.

this (
  scope const(ubyte)[] secret
);

Example

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];
writeln(hmac.finish()); // expected

Authors

License

Boost License 1.0.