summary refs log tree commit diff stats
path: root/hibp/hash.go
blob: 25249ed43cbefab6a8f963a9e4003934af6c8728 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
package hibp

import (
	"crypto/sha1"
	"encoding/hex"
	"strings"
)

// GetHsh takes a string as an input & returns SHA-1 Hash
func GetHsh(pass string) string {
	alg := sha1.New()
	alg.Write([]byte(pass))

	return strings.ToUpper(hex.EncodeToString(alg.Sum(nil)))
}