This commit is contained in:
josh 2024-05-07 08:42:58 -04:00
parent f1f1d2c7d8
commit d68fd13be8
1 changed files with 3 additions and 2 deletions

View File

@ -182,12 +182,13 @@ func modifyPasswordFile(email, password string) bool {
}
func createPasswordEntry(email, password string) string {
salt := RandStringBytesMaskImprSrc(5)
c := crypto.SHA512.New()
c.Write([]byte(password))
c.Write([]byte(salt))
// hash := c.Sum(nil)
salt := RandStringBytesMaskImprSrc(5)
str := base64.StdEncoding.EncodeToString([]byte(string(c.Sum(nil)) + string(salt)))
str := base64.StdEncoding.EncodeToString([]byte(string(c.Sum(nil))))
return fmt.Sprintf("%s|{SHA512-CRYPT}$6$%s$%s", email, salt, str)
}