13 lines
247 B
Go
13 lines
247 B
Go
![]() |
package utils
|
||
|
|
||
|
import "golang.org/x/crypto/bcrypt"
|
||
|
|
||
|
func HashPassword(password string) (string, error) {
|
||
|
pw, err := bcrypt.GenerateFromPassword([]byte(password), bcrypt.DefaultCost)
|
||
|
if err != nil {
|
||
|
return "", err
|
||
|
}
|
||
|
|
||
|
return string(pw), nil
|
||
|
}
|