summary refs log blame commit diff stats
path: root/hibp/hash.go
blob: 9b8d35c63c1e9d540b766512efb5d42b6aa3e456 (plain) (tree)
1
2
3
4
5
6
7
8
9
10







                      

                                                              




                                                                
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)))
}