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.start

Reinitializes the digest, making it ready for reuse.

ref HMAC!(H,blockSize) start();

Note

The constructor leaves the digest in an initialized state, so that this method only needs to be called if an unfinished digest is to be reused.

Returns

A reference to the digest for convenient chaining.

Example

import std.digest.sha : SHA1;
import std.string : representation;
string data1 = "Hello, world", data2 = "Hola mundo";
auto hmac = HMAC!SHA1("My s3cR3T keY".representation);
hmac.put(data1.representation);
hmac.start();                   // reset digest
hmac.put(data2.representation); // start over
static immutable expected = [
    122, 151, 232, 240, 249, 80,
    19, 178, 186, 77, 110, 23, 208,
    52, 11, 88, 34, 151, 192, 255];
writeln(hmac.finish()); // expected

Authors

License

Boost License 1.0.