From d68fd13be8aa835f5bca1898df019d9d7953b7df Mon Sep 17 00:00:00 2001 From: josh Date: Tue, 7 May 2024 08:42:58 -0400 Subject: [PATCH] salt --- main.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) 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) }