salt
This commit is contained in:
parent
f1f1d2c7d8
commit
d68fd13be8
5
main.go
5
main.go
|
@ -182,12 +182,13 @@ func modifyPasswordFile(email, password string) bool {
|
||||||
}
|
}
|
||||||
|
|
||||||
func createPasswordEntry(email, password string) string {
|
func createPasswordEntry(email, password string) string {
|
||||||
|
salt := RandStringBytesMaskImprSrc(5)
|
||||||
c := crypto.SHA512.New()
|
c := crypto.SHA512.New()
|
||||||
c.Write([]byte(password))
|
c.Write([]byte(password))
|
||||||
|
c.Write([]byte(salt))
|
||||||
// hash := c.Sum(nil)
|
// 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)
|
return fmt.Sprintf("%s|{SHA512-CRYPT}$6$%s$%s", email, salt, str)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue