This commit is contained in:
josh 2024-05-07 08:32:10 -04:00
parent 8f5b4b921a
commit b06246c2d8
1 changed files with 2 additions and 2 deletions

View File

@ -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)