mirror of
https://github.com/gohugoio/hugo.git
synced 2024-11-14 20:37:55 -05:00
ec920363cd
4c5edacfe cSpell config update (#1700) 9df788b25 Fix broken link (hugo modules) (#1710) 9928a70d6 Fix workspace formatting (#1707) 55467e7c8 Update partials.md 9f4bd0023 Update formats.md 9b3913c86 Remove footnoteAnchorPrefix and footnoteReturnLinkContents (#1704) 94502a09b Code block render hooks are introduced in v0.93.0 (#1701) c447270ef Update sitemap-template.md 78665c1e0 Update sitemap-template.md 60653c17d Update the caddy error docs link (#1696) 9a3675aad Update sitemap templates (#1699) e0d08cdbb Add wpxr-to-static to list of migration tools (#1512) b53eb5a08 Add page for deploying with rclone (#1511) 4207c57ff netlify: Hugo 0.96.0 a18d646ea docs: Regen docshelper e3e0981ed docs: Regen CLI docs fda988d01 Merge commit 'd276e901b36d2576ef8350ed96b17f66254eac1b' e4a26dbca tpl/crypto: Add optional encoding arg to hmac function git-subtree-dir: docs git-subtree-split: 4c5edacfeebd13eb7f876723c065466cd50e0cae
34 lines
969 B
Markdown
34 lines
969 B
Markdown
---
|
|
title: hmac
|
|
linktitle: hmac
|
|
description: Returns a cryptographic hash that uses a key to sign a message.
|
|
date: 2020-05-29
|
|
publishdate: 2020-05-29
|
|
lastmod: 2020-05-29
|
|
categories: [functions]
|
|
menu:
|
|
docs:
|
|
parent: "functions"
|
|
keywords: [hmac,checksum]
|
|
signature: ["crypto.HMAC HASH_TYPE KEY MESSAGE [ENCODING]","hmac HASH_TYPE KEY MESSAGE [ENCODING]" ]
|
|
workson: []
|
|
hugoversion:
|
|
relatedfuncs: [hmac]
|
|
deprecated: false
|
|
aliases: []
|
|
---
|
|
|
|
Set the `HASH_TYPE` argument to `md5`, `sha1`, `sha256`, or `sha512`.
|
|
|
|
Set the optional `ENCODING` argument to either `hex` (default) or `binary`.
|
|
|
|
```go-html-template
|
|
{{ hmac "sha256" "Secret key" "Secret message" }}
|
|
5cceb491f45f8b154e20f3b0a30ed3a6ff3027d373f85c78ffe8983180b03c84
|
|
|
|
{{ hmac "sha256" "Secret key" "Secret message" "hex" }}
|
|
5cceb491f45f8b154e20f3b0a30ed3a6ff3027d373f85c78ffe8983180b03c84
|
|
|
|
{{ hmac "sha256" "Secret key" "Secret message" "binary" | base64Encode }}
|
|
XM60kfRfixVOIPOwow7Tpv8wJ9Nz+Fx4/+iYMYCwPIQ=
|
|
```
|