hugo/docs/content/en/functions/hmac.md
2022-03-23 19:42:56 +01:00

969 B

title linktitle description date publishdate lastmod categories menu keywords signature workson hugoversion relatedfuncs deprecated aliases
hmac hmac Returns a cryptographic hash that uses a key to sign a message. 2020-05-29 2020-05-29 2020-05-29
functions
docs
parent
functions
hmac
checksum
crypto.HMAC HASH_TYPE KEY MESSAGE [ENCODING]
hmac HASH_TYPE KEY MESSAGE [ENCODING]
hmac
false

Set the HASH_TYPE argument to md5, sha1, sha256, or sha512.

Set the optional ENCODING argument to either hex (default) or binary.

{{ 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=