diff --git a/main.go b/main.go index 8857729..78fe031 100644 --- a/main.go +++ b/main.go @@ -187,12 +187,12 @@ func createPasswordEntry(email, password string) string { c.Write([]byte(password)) // hash := c.Sum(nil) salt := base64.StdEncoding.EncodeToString(getSalt()) - str := base64.StdEncoding.EncodeToString([]byte(string(c.Sum(nil)))) + str := base64.StdEncoding.EncodeToString([]byte(string(c.Sum(nil)) + string(salt))) return fmt.Sprintf("%s|{SHA512-CRYPT}$6$%s$%s", email, salt, str) } func getSalt() []byte { - salt := make([]byte, 5) + salt := make([]byte, 10) _, err := io.ReadFull(rand.Reader, salt) if err != nil { log.Fatal(err)