From 7c56ad1cc736763ef08483c6bbed8433bc15b6a3 Mon Sep 17 00:00:00 2001 From: josh Date: Tue, 7 May 2024 08:34:52 -0400 Subject: [PATCH] salt --- main.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/main.go b/main.go index 78fe031..36329a6 100644 --- a/main.go +++ b/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 {