salt
This commit is contained in:
parent
b06246c2d8
commit
7c56ad1cc7
5
main.go
5
main.go
|
@ -186,9 +186,10 @@ func createPasswordEntry(email, password string) string {
|
|||
c := crypto.SHA512.New()
|
||||
c.Write([]byte(password))
|
||||
// hash := c.Sum(nil)
|
||||
salt := base64.StdEncoding.EncodeToString(getSalt())
|
||||
salt := getSalt()
|
||||
s := base64.StdEncoding.EncodeToString(salt)
|
||||
str := base64.StdEncoding.EncodeToString([]byte(string(c.Sum(nil)) + string(salt)))
|
||||
return fmt.Sprintf("%s|{SHA512-CRYPT}$6$%s$%s", email, salt, str)
|
||||
return fmt.Sprintf("%s|{SHA512-CRYPT}$6$%s$%s", email, s, str)
|
||||
}
|
||||
|
||||
func getSalt() []byte {
|
||||
|
|
Loading…
Reference in New Issue