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.
Module std.digest.hmac
This package implements the hash-based message authentication code (HMAC) algorithm as defined in RFC2104. See also the corresponding Wikipedia article.
Example
Template API HMAC implementation.
This implements an HMAC over the digest H. If H doesn't provide information about the block size, it can be supplied explicitly using the second overload.
This type conforms to std
.
Compute HMAC over an input string
import std .ascii : LetterCase;
import std .digest : toHexString;
import std .digest .sha : SHA1;
import std .string : representation;
auto secret = "secret" .representation;
assert("The quick brown fox jumps over the lazy dog"
.representation
.hmac!SHA1(secret)
.toHexString!(LetterCase .lower) == "198ea1ea04c435c1246b586a06d5cf11c3ffcda6");
Structs
Name | Description |
---|---|
HMAC
|
Overload of HMAC to be used if H doesn't provide information about its block size. |
Templates
Name | Description |
---|---|
hmac
|
Overload of HMAC to be used if H doesn't provide information about its block size. |
Aliases
Name | Type | Description |
---|---|---|
hmac
|
hmac!(H,H.blockSize)
|
Overload of HMAC to be used if H doesn't provide information about its block size. |
Authors
License
Copyright © 1999-2018 by the D Language Foundation | Page generated by ddox.