diff options
| author | Craig Jennings <c@cjennings.net> | 2025-08-14 22:58:58 -0500 |
|---|---|---|
| committer | Craig Jennings <c@cjennings.net> | 2025-08-14 22:58:58 -0500 |
| commit | 82ba818ff456bcd6d56a06226e3f27e98fbb55c3 (patch) | |
| tree | 158cfc17b2f644a10f063cb546752cfaae12c97f /devdocs/go/crypto%2Fhmac%2Findex.html | |
| parent | 9278ddd4ea1a8b1a4c1edaa8894516e3f48d245b (diff) | |
| download | dotemacs-82ba818ff456bcd6d56a06226e3f27e98fbb55c3.tar.gz dotemacs-82ba818ff456bcd6d56a06226e3f27e98fbb55c3.zip | |
removing all downloaded devdocs files
Diffstat (limited to 'devdocs/go/crypto%2Fhmac%2Findex.html')
| -rw-r--r-- | devdocs/go/crypto%2Fhmac%2Findex.html | 23 |
1 files changed, 0 insertions, 23 deletions
diff --git a/devdocs/go/crypto%2Fhmac%2Findex.html b/devdocs/go/crypto%2Fhmac%2Findex.html deleted file mode 100644 index e08e7719..00000000 --- a/devdocs/go/crypto%2Fhmac%2Findex.html +++ /dev/null @@ -1,23 +0,0 @@ -<h1> Package hmac </h1> <ul id="short-nav"> -<li><code>import "crypto/hmac"</code></li> -<li><a href="#pkg-overview" class="overviewLink">Overview</a></li> -<li><a href="#pkg-index" class="indexLink">Index</a></li> -</ul> <h2 id="pkg-overview">Overview </h2> <p>Package hmac implements the Keyed-Hash Message Authentication Code (HMAC) as defined in U.S. Federal Information Processing Standards Publication 198. An HMAC is a cryptographic hash that uses a key to sign a message. The receiver verifies the hash by recomputing it using the same key. </p> -<p>Receivers should be careful to use Equal to compare MACs in order to avoid timing side-channels: </p> -<pre data-language="go">// ValidMAC reports whether messageMAC is a valid HMAC tag for message. -func ValidMAC(message, messageMAC, key []byte) bool { - mac := hmac.New(sha256.New, key) - mac.Write(message) - expectedMAC := mac.Sum(nil) - return hmac.Equal(messageMAC, expectedMAC) -} -</pre> <h2 id="pkg-index">Index </h2> <ul id="manual-nav"> -<li><a href="#Equal">func Equal(mac1, mac2 []byte) bool</a></li> -<li><a href="#New">func New(h func() hash.Hash, key []byte) hash.Hash</a></li> -</ul> <h3>Package files</h3> <p> <span>hmac.go</span> </p> <h2 id="Equal">func <span>Equal</span> <span title="Added in Go 1.1">1.1</span> </h2> <pre data-language="go">func Equal(mac1, mac2 []byte) bool</pre> <p>Equal compares two MACs for equality without leaking timing information. </p> -<h2 id="New">func <span>New</span> </h2> <pre data-language="go">func New(h func() hash.Hash, key []byte) hash.Hash</pre> <p>New returns a new HMAC hash using the given <span>hash.Hash</span> type and key. New functions like sha256.New from <span>crypto/sha256</span> can be used as h. h must return a new Hash every time it is called. Note that unlike other hash implementations in the standard library, the returned Hash does not implement <span>encoding.BinaryMarshaler</span> or <span>encoding.BinaryUnmarshaler</span>. </p><div class="_attribution"> - <p class="_attribution-p"> - © Google, Inc.<br>Licensed under the Creative Commons Attribution License 3.0.<br> - <a href="http://golang.org/pkg/crypto/hmac/" class="_attribution-link">http://golang.org/pkg/crypto/hmac/</a> - </p> -</div> |
