Files
Volleyball/backend/internal/common/passwordHasher.go

13 lines
307 B
Go

package common
import "golang.org/x/crypto/bcrypt"
func HashPassword(password string) (string, error) {
// Use bcrypt to hash the password
hashedPassword, err := bcrypt.GenerateFromPassword([]byte(password), bcrypt.DefaultCost)
if err != nil {
return "", err
}
return string(hashedPassword), nil
}