changes...
This commit is contained in:
parent
41944884b4
commit
ab4b53fd40
26 changed files with 600 additions and 51 deletions
21
internal/utils/password_crypt.go
Normal file
21
internal/utils/password_crypt.go
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
package utils
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"golang.org/x/crypto/bcrypt"
|
||||
)
|
||||
|
||||
func EncryptPassword(pass string) (string, error) {
|
||||
var salted string
|
||||
salt := "58_team:%s:1205secret"
|
||||
|
||||
salted = fmt.Sprintf(salt, pass)
|
||||
|
||||
hashed, err := bcrypt.GenerateFromPassword([]byte(salted), 12)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
return string(hashed), nil
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue