diff --git a/main.go b/main.go index 349b2ab..ffe5486 100644 --- a/main.go +++ b/main.go @@ -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) }