base64
This commit is contained in:
5
main.go
5
main.go
@@ -2,6 +2,7 @@ package main
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"crypto"
|
"crypto"
|
||||||
|
"encoding/base64"
|
||||||
"fmt"
|
"fmt"
|
||||||
"log"
|
"log"
|
||||||
"net/http"
|
"net/http"
|
||||||
@@ -182,5 +183,7 @@ func createPasswordEntry(email, password string) string {
|
|||||||
c := crypto.SHA512.New()
|
c := crypto.SHA512.New()
|
||||||
c.Write([]byte(password))
|
c.Write([]byte(password))
|
||||||
hash := c.Sum(nil)
|
hash := c.Sum(nil)
|
||||||
return fmt.Sprintf("%s|{SHA512-CRYPT}$6$%s", email, hash)
|
str := base64.StdEncoding.EncodeToString(hash)
|
||||||
|
|
||||||
|
return fmt.Sprintf("%s|{SHA512-CRYPT}$6$%s", email, str)
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user