From d77be313111878f708a8b1f95acf1a1f72e48196 Mon Sep 17 00:00:00 2001 From: Yonas Yanfa Date: Sun, 19 Nov 2023 04:52:09 -0500 Subject: [PATCH] Add BLAKE-3 to templates.go (#2701) --- docs/commands/process.md | 1 + docs/commands/templates.md | 1 + internal/action/templates.go | 1 + internal/tpl/template_test.go | 2 +- 4 files changed, 4 insertions(+), 1 deletion(-) diff --git a/docs/commands/process.md b/docs/commands/process.md index abcc6c258a..d387acf1a0 100644 --- a/docs/commands/process.md +++ b/docs/commands/process.md @@ -58,3 +58,4 @@ Function | Example | Description `argon2i` | `{{ getpw "foo/bar" \| argon2i }}` | Calculate the Argon2i hash of the input. `argon2id` | `{{ getpw "foo/bar" \| argon2id }}` | Calculate the Argon2id hash of the input. `bcrypt` | `{{ getpw "foo/bar" \| bcrypt }}` | Calculate the Bcrypt hash of the input. +`blake3` | `{{ getpw "foo/bar" \| blake3 }}` | Calculate the BLAKE-3 hash of the input. diff --git a/docs/commands/templates.md b/docs/commands/templates.md index ca76692471..9aa9f34f3d 100644 --- a/docs/commands/templates.md +++ b/docs/commands/templates.md @@ -59,6 +59,7 @@ Function | Example | Description `argon2i` | `{{ .Content \| argon2i }}` | Calculate the Argon2i hash of the input. `argon2id` | `{{ .Content \| argon2id }}` | Calculate the Argon2id hash of the input. `bcrypt` | `{{ .Content \| bcrypt }}` | Calculate the Bcrypt hash of the input. +`blake3` | `{{ .Content \| blake3 }}` | Calculate the BLAKE-3 hash of the input. ## Template variables diff --git a/internal/action/templates.go b/internal/action/templates.go index 145189f8e9..c61132198b 100644 --- a/internal/action/templates.go +++ b/internal/action/templates.go @@ -29,6 +29,7 @@ const ( # Available Template functions: # - md5sum: e.g. {{ .Content | md5sum }} # - sha1sum: e.g. {{ .Content | sha1sum }} +# - blake3 e.g. {{ .Content | blake3 }} # - md5crypt: e.g. {{ .Content | md5crypt }} # - ssha: e.g. {{ .Content | ssha }} # - ssha256: e.g. {{ .Content | ssha256 }} diff --git a/internal/tpl/template_test.go b/internal/tpl/template_test.go index 4338546d29..30835ccfc8 100644 --- a/internal/tpl/template_test.go +++ b/internal/tpl/template_test.go @@ -24,7 +24,7 @@ func Example() { //nolint:testableexamples Password-value of the new entry: {{ .Content }} Md5sum of the new password: {{ .Content | md5sum }} Sha1sum of the new password: {{ .Content | sha1sum }} -Blake3sum of the new password: {{ .Content | blake3sum }} +Blake3 of the new password: {{ .Content | blake3 }} Md5crypt of the new password: {{ .Content | md5crypt }} SSHA of the new password: {{ .Content | ssha }} SSHA256 of the new password: {{ .Content | ssha256 }}