tpl/crypto: Add hmac

This commit is contained in:
Edouard 2020-06-05 20:04:11 +02:00 committed by GitHub
parent 260130cc02
commit c7cdebed38
2 changed files with 51 additions and 0 deletions

View File

@ -0,0 +1,34 @@
---
title: hmac
linktitle: hmac
description: Compute the cryptographic checksum of a message.
godocref:
date: 2020-05-29
publishdate: 2020-05-29
lastmod: 2020-05-29
categories: [functions]
menu:
docs:
parent: "functions"
keywords: [hmac,checksum]
signature: ["hmac HASH_TYPE KEY MESSAGE"]
workson: []
hugoversion:
relatedfuncs: [hmac]
deprecated: false
aliases: [hmac]
---
`hmac` returns a cryptographic hash that uses a key to sign a message.
```
{{ hmac "sha256" "Secret key" "Hello world, gophers!"}},
<!-- returns the string "b6d11b6c53830b9d87036272ca9fe9d19306b8f9d8aa07b15da27d89e6e34f40"
```
Supported hash functions:
* md5
* sha1
* sha256
* sha512

View File

@ -3059,6 +3059,23 @@
"6ec43b78da9669f50e4e422575c54bf87536954ccd58280219c393f2ce352b46"
]
]
},
"HMAC": {
"Description": "HMAC hashes the concatenation of a message and a secret key with the given hash function and returns its checksum.",
"Args": [
"hash function",
"message",
"key"
],
"Aliases": [
"hmac"
],
"Examples": [
[
"{{ hmac \"sha256\" \"Hello Gopher!\" \"Hello world, gophers!\" }}",
"32aea97d5688891fb35175c5518012323a3079994b909dd6f1bc481e4d0e7ce9"
]
]
}
},
"data": {