1
0
mirror of https://github.com/Luzifer/korvike.git synced 2024-09-19 00:42:57 +00:00
korvike/functions/func_hash.go
Knut Ahlers e8a8b2f83f
Breaking: Add sprig functions, replace some internal ones
Breaking changes:

- Remove function `b64decode`, use `b64dec`
- Remove function `b64encode`, use `b64enc`
- Remove default from `env`, use `env "MYVAR" | default "..."`
- Remove function `hash`, use `sha1sum` / `sha256sum` / `sha512sum`
- Function `now` returns `time.Time`, use `now | date "[format]"`
- Function `split` now has reversed parameters `split <sep> <str>`

Signed-off-by: Knut Ahlers <knut@ahlers.me>
2024-02-28 23:54:18 +01:00

14 lines
217 B
Go

package functions
import (
"crypto/sha512"
"encoding/hex"
)
func init() {
registerFunction("sha512sum", func(data string) string {
hash := sha512.Sum512([]byte(data))
return hex.EncodeToString(hash[:])
})
}