package Auth import ( "golang.org/x/crypto/bcrypt" ) func HashPassword(password string) (string, error) { var ( bytes []byte err error ) bytes, err = bcrypt.GenerateFromPassword([]byte(password), 14) return string(bytes), err } func CheckPasswordHash(password, hash string) bool { var ( err error ) err = bcrypt.CompareHashAndPassword([]byte(hash), []byte(password)) return err == nil }