all repos — homestead @ cc941b5e3b8745f02e11f1f6a0c3c67ab8251952

Code for my website

internal/builder/template/hasher.go (view raw)

1
2
3
4
5
6
7
8
9
10
11
12
13
package template

import (
	"crypto/sha256"
	"encoding/base64"
)

func Hash(s string) string {
	shasum := sha256.New()
	shasum.Write([]byte(s))

	return "sha256-" + base64.StdEncoding.EncodeToString(shasum.Sum(nil))
}