This commit is contained in:
Lakhan Samani
2021-07-17 22:39:50 +05:30
parent 9b8658f666
commit 245a5b5e1b
4 changed files with 18 additions and 22 deletions

View File

@@ -0,0 +1,12 @@
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
}