mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-19 21:21:39 +02:00
Merge commit '9b0050e9aabe4be65c78ccf292a348f309d50ccd' as 'docs'
``` git subtree add --prefix=docs/ https://github.com/gohugoio/hugoDocs.git master --squash ``` Closes #11925
This commit is contained in:
22
docs/content/en/functions/crypto/FNV32a.md
Normal file
22
docs/content/en/functions/crypto/FNV32a.md
Normal file
@@ -0,0 +1,22 @@
|
||||
---
|
||||
title: crypto.FNV32a
|
||||
description: Returns the FNV (Fowler–Noll–Vo) 32-bit hash of a given string.
|
||||
categories: []
|
||||
keywords: []
|
||||
action:
|
||||
aliases: []
|
||||
related:
|
||||
- functions/crypto/HMAC
|
||||
- functions/crypto/MD5
|
||||
- functions/crypto/SHA1
|
||||
- functions/crypto/SHA256
|
||||
returnType: int
|
||||
signatures: [crypto.FNV32a STRING]
|
||||
aliases: [/functions/crypto.fnv32a]
|
||||
---
|
||||
|
||||
This function calculates the 32-bit [FNV1a hash](https://en.wikipedia.org/wiki/Fowler%E2%80%93Noll%E2%80%93Vo_hash_function#FNV-1a_hash) of a given string according to the [specification](https://datatracker.ietf.org/doc/html/draft-eastlake-fnv-12):
|
||||
|
||||
```go-html-template
|
||||
{{ crypto.FNV32a "Hello world" }} → 1498229191
|
||||
```
|
31
docs/content/en/functions/crypto/HMAC.md
Normal file
31
docs/content/en/functions/crypto/HMAC.md
Normal file
@@ -0,0 +1,31 @@
|
||||
---
|
||||
title: crypto.HMAC
|
||||
description: Returns a cryptographic hash that uses a key to sign a message.
|
||||
categories: []
|
||||
keywords: []
|
||||
action:
|
||||
aliases: [hmac]
|
||||
related:
|
||||
- functions/crypto/FNV32a
|
||||
- functions/crypto/MD5
|
||||
- functions/crypto/SHA1
|
||||
- functions/crypto/SHA256
|
||||
returnType: string
|
||||
signatures: ['crypto.HMAC HASH_TYPE KEY MESSAGE [ENCODING]']
|
||||
aliases: [/functions/hmac]
|
||||
---
|
||||
|
||||
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=
|
||||
```
|
26
docs/content/en/functions/crypto/MD5.md
Normal file
26
docs/content/en/functions/crypto/MD5.md
Normal file
@@ -0,0 +1,26 @@
|
||||
---
|
||||
title: crypto.MD5
|
||||
description: Hashes the given input and returns its MD5 checksum encoded to a hexadecimal string.
|
||||
categories: []
|
||||
keywords: []
|
||||
action:
|
||||
aliases: [md5]
|
||||
related:
|
||||
- functions/crypto/FNV32a
|
||||
- functions/crypto/HMAC
|
||||
- functions/crypto/SHA1
|
||||
- functions/crypto/SHA256
|
||||
returnType: string
|
||||
signatures: [crypto.MD5 INPUT]
|
||||
aliases: [/functions/md5]
|
||||
---
|
||||
|
||||
```go-html-template
|
||||
{{ md5 "Hello world" }} → 3e25960a79dbc69b674cd4ec67a72c62
|
||||
```
|
||||
|
||||
This can be useful if you want to use [Gravatar](https://en.gravatar.com/) for generating a unique avatar:
|
||||
|
||||
```html
|
||||
<img src="https://www.gravatar.com/avatar/{{ md5 "your@email.com" }}?s=100&d=identicon">
|
||||
```
|
20
docs/content/en/functions/crypto/SHA1.md
Normal file
20
docs/content/en/functions/crypto/SHA1.md
Normal file
@@ -0,0 +1,20 @@
|
||||
---
|
||||
title: crypto.SHA1
|
||||
description: Hashes the given input and returns its SHA1 checksum encoded to a hexadecimal string.
|
||||
categories: []
|
||||
keywords: []
|
||||
action:
|
||||
aliases: [sha1]
|
||||
related:
|
||||
- functions/crypto/FNV32a
|
||||
- functions/crypto/HMAC
|
||||
- functions/crypto/MD5
|
||||
- functions/crypto/SHA256
|
||||
returnType: string
|
||||
signatures: [crypto.SHA1 INPUT]
|
||||
aliases: [/functions/sha,/functions/sha1]
|
||||
---
|
||||
|
||||
```go-html-template
|
||||
{{ sha1 "Hello world" }} → 7b502c3a1f48c8609ae212cdfb639dee39673f5e
|
||||
```
|
20
docs/content/en/functions/crypto/SHA256.md
Normal file
20
docs/content/en/functions/crypto/SHA256.md
Normal file
@@ -0,0 +1,20 @@
|
||||
---
|
||||
title: crypto.SHA256
|
||||
description: Hashes the given input and returns its SHA256 checksum encoded to a hexadecimal string.
|
||||
categories: []
|
||||
keywords: []
|
||||
action:
|
||||
aliases: [sha256]
|
||||
related:
|
||||
- functions/crypto/FNV32a
|
||||
- functions/crypto/HMAC
|
||||
- functions/crypto/MD5
|
||||
- functions/crypto/SHA1
|
||||
returnType: string
|
||||
signatures: [crypto.SHA256 INPUT]
|
||||
aliases: [/functions/sha256]
|
||||
---
|
||||
|
||||
```go-html-template
|
||||
{{ sha256 "Hello world" }} → 64ec88ca00b268e5ba1a35678a1b5316d212f4f366b2477232534a8aeca37f3c
|
||||
```
|
12
docs/content/en/functions/crypto/_index.md
Normal file
12
docs/content/en/functions/crypto/_index.md
Normal file
@@ -0,0 +1,12 @@
|
||||
---
|
||||
title: Crypto functions
|
||||
linkTitle: crypto
|
||||
description: Template functions to create cryptographic hashes.
|
||||
categories: []
|
||||
keywords: []
|
||||
menu:
|
||||
docs:
|
||||
parent: functions
|
||||
---
|
||||
|
||||
Use these functions to create cryptographic hashes.
|
Reference in New Issue
Block a user