This commit is contained in:
josh 2024-05-07 08:34:52 -04:00
parent b06246c2d8
commit 7c56ad1cc7
1 changed files with 3 additions and 2 deletions

View File

@ -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 {