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