Skip to content

Commit

Permalink
Add namespace for hash functions
Browse files Browse the repository at this point in the history
  • Loading branch information
jmooring authored and bep committed Jul 17, 2024
1 parent 70fe8d2 commit 397c81c
Show file tree
Hide file tree
Showing 4 changed files with 61 additions and 3 deletions.
11 changes: 8 additions & 3 deletions content/en/functions/crypto/FNV32a.md
Original file line number Diff line number Diff line change
@@ -1,21 +1,26 @@
---
title: crypto.FNV32a
description: Returns the FNV (Fowler–Noll–Vo) 32-bit hash of a given string.
description: Returns the 32-bit FNV (Fowler–Noll–Vo) non-cryptographic hash of the given string.
categories: []
keywords: []
action:
aliases: []
related:
- functions/hash/Xxhash
- functions/crypto/HMAC
- functions/crypto/MD5
- functions/crypto/SHA1
- functions/crypto/SHA256
returnType: int
signatures: [crypto.FNV32a STRING]
aliases: [/functions/crypto.fnv32a]
expiryDate: 2025-07-31 # deprecated 2024-07-31
---

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):
{{% deprecated-in 0.129.0 %}}
Use [`hash.FNV32a`] instead.

[`hash.FNV32a`]: /functions/hash/FNV32a/
{{% /deprecated-in %}}

```go-html-template
{{ crypto.FNV32a "Hello world" }} → 1498229191
Expand Down
21 changes: 21 additions & 0 deletions content/en/functions/hash/FNV32a.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
---
title: hash.FNV32a
description: Returns the 32-bit FNV (Fowler–Noll–Vo) non-cryptographic hash of the given string.
categories: []
keywords: []
action:
aliases: []
related:
- functions/hash/Xxhash
- functions/crypto/HMAC
- functions/crypto/MD5
- functions/crypto/SHA1
- functions/crypto/SHA256
returnType: int
signatures: [hash.FNV32a STRING]
aliases: [/functions/crypto.fnv32a]
---

```go-html-template
{{ hash.FNV32a "Hello world" }} → 1498229191
```
20 changes: 20 additions & 0 deletions content/en/functions/hash/XxHash.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
title: hash.XxHash
description: Returns the 64-bit xxHash non-cryptographic hash of the given string.
categories: []
keywords: []
action:
aliases: []
related:
- functions/hash/FNV32a
- functions/crypto/HMAC
- functions/crypto/MD5
- functions/crypto/SHA1
- functions/crypto/SHA256
returnType: string
signatures: [hash.XxHash STRING]
---

```go-html-template
{{ hash.XxHash "Hello world" }} → c500b0c912b376d8
```
12 changes: 12 additions & 0 deletions content/en/functions/hash/_index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
title: Hash functions
linkTitle: hash
description: Template functions to create non-cryptographic hashes.
categories: []
keywords: []
menu:
docs:
parent: functions
---

Use these functions to create non-cryptographic hashes.

0 comments on commit 397c81c

Please sign in to comment.