diff --git a/pkg/templatelib/lib.go b/pkg/templatelib/lib.go index 9e87531e..1ebedcd3 100644 --- a/pkg/templatelib/lib.go +++ b/pkg/templatelib/lib.go @@ -1,6 +1,8 @@ package templatelib import ( + "crypto/sha256" + "encoding/hex" "encoding/json" "fmt" "os" @@ -135,4 +137,10 @@ var FuncMap = template.FuncMap{ return unsetVal } }), + + // {{- sha256sum "hello world" -}} + "sha256sum": func(input string) string { + hash := sha256.Sum256([]byte(input)) + return hex.EncodeToString(hash[:]) + }, }