summary refs log tree commit diff stats
path: root/hibp/hash.go
blob: 9b8d35c63c1e9d540b766512efb5d42b6aa3e456 (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"
)

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

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