// Valid checks if provided plaintext is valid for given hash
321542
func (p *Provider) Valid(hash, plain []byte) bool {
	return gobcrypt.CompareHashAndPassword(hash, plain) == nil
}
654475
func (h Hash) IsValid() bool {
	if len(h.h) < MinHashByteLength {
		return false
	}
	if len(h.h) > MaxHashByteLength {
		return false
	}

	if h.hashType() == InvalidHash {
		return false
	}

	return true
}
366665
func Valid(cpf string) bool {
	isValid, err := AssertValid(cpf)
	if err != nil {
		return false
	}
	return isValid
}
1146580
func PasswordValid(hash, password []byte) bool {
	p := matchProvider(hash)
	if p == nil {
		return false
	}
	return p.Valid(hash, password)
}
1183252
func (a Action) Valid() (err error) {
	switch a {
	case ReadAction: // 1
	case WriteAction: // 2
	default:
		err = ErrInvalidAction
	}

	return err
}
1333946
func (c CurrSymbol) Valid() (bool, error) {
	if c.String() == "XXX" {
		return false, fmt.Errorf("Invalid CurrSymbol: %s", c.Unit)
	}
	return true, nil
}
413823
func (r *patchDashboardRequest) Valid() error {
	if !r.DashboardID.Valid() {
		return &platform.Error{
			Code: platform.EInvalid,
			Msg:  "missing dashboard ID",
		}
	}

	if pe := r.Upd.Valid(); pe != nil {
		return pe
	}
	return nil
}
740697
func (tacl *tableACL) Valid() bool {
	tacl.RLock()
	defer tacl.RUnlock()
	return tacl.entries != nil
}
114509
func (l LevelInfo) Valid() bool {
	return level.IsValidPriority(l.Default) && level.IsValidPriority(l.Threshold)
}
14668
func (u DashboardUpdate) Valid() *Error {
	if u.Name == nil && u.Description == nil {
		return &Error{
			Code: EInvalid,
			Msg:  "must update at least one attribute",
		}
	}

	return nil
}
382588
func valid(authorization []string) bool {
	if len(authorization) < 1 {
		return false
	}
	token := strings.TrimPrefix(authorization[0], "Bearer ")
	// Perform the token validation here. For the sake of this example, the code
	// here forgoes any of the usual OAuth2 token validation and instead checks
	// for a token matching an arbitrary string.
	return token == "some-secret-token"
}
549399
func (u *MacroUpdate) Valid() error {
	if u.Name == "" && u.Selected == nil && u.Arguments == nil {
		return fmt.Errorf("no fields supplied in update")
	}

	return nil
}
102598
func (ck *HttpCheck) Valid() error {
	if ck.Name == "" {
		return fmt.Errorf("Invalid value for `Name`.  Must contain non-empty string")
	}

	if ck.Hostname == "" {
		return fmt.Errorf("Invalid value for `Hostname`.  Must contain non-empty string")
	}

	if ck.Resolution != 1 && ck.Resolution != 5 && ck.Resolution != 15 &&
		ck.Resolution != 30 && ck.Resolution != 60 {
		return fmt.Errorf("invalid value %v for `Resolution`, allowed values are [1,5,15,30,60]", ck.Resolution)
	}

	if ck.ShouldContain != "" && ck.ShouldNotContain != "" {
		return fmt.Errorf("`ShouldContain` and `ShouldNotContain` must not be declared at the same time")
	}

	return nil
}
667207
func (c *Config) Valid() error {
	if c.Security.SkipGrantTable && !hasRootPrivilege() {
		return fmt.Errorf("TiDB run with skip-grant-table need root privilege")
	}
	if _, ok := ValidStorage[c.Store]; !ok {
		nameList := make([]string, 0, len(ValidStorage))
		for k, v := range ValidStorage {
			if v {
				nameList = append(nameList, k)
			}
		}
		return fmt.Errorf("invalid store=%s, valid storages=%v", c.Store, nameList)
	}
	if c.Store == "mocktikv" && !c.RunDDL {
		return fmt.Errorf("can't disable DDL on mocktikv")
	}
	if c.Log.File.MaxSize > MaxLogFileSize {
		return fmt.Errorf("invalid max log file size=%v which is larger than max=%v", c.Log.File.MaxSize, MaxLogFileSize)
	}
	c.OOMAction = strings.ToLower(c.OOMAction)

	// lower_case_table_names is allowed to be 0, 1, 2
	if c.LowerCaseTableNames < 0 || c.LowerCaseTableNames > 2 {
		return fmt.Errorf("lower-case-table-names should be 0 or 1 or 2")
	}

	if c.TxnLocalLatches.Enabled && c.TxnLocalLatches.Capacity == 0 {
		return fmt.Errorf("txn-local-latches.capacity can not be 0")
	}

	// For tikvclient.
	if c.TiKVClient.GrpcConnectionCount == 0 {
		return fmt.Errorf("grpc-connection-count should be greater than 0")
	}
	if c.TiKVClient.MaxTxnTimeUse == 0 {
		return fmt.Errorf("max-txn-time-use should be greater than 0")
	}
	return nil
}
619836
func (acl *ACL) Valid() bool {
	rv := C.acl_valid(acl.a)
	if rv < 0 {
		return false
	}
	return true
}
56790
func (ck *MaintenanceWindow) Valid() error {
	if ck.Description == "" {
		return fmt.Errorf("Invalid value for `Description`.  Must contain non-empty string")
	}

	if ck.From == 0 {
		return fmt.Errorf("Invalid value for `From`.  Must contain time")
	}

	if ck.To == 0 {
		return fmt.Errorf("Invalid value for `To`.  Must contain time")
	}

	return nil
}
953047
func (pr *ProfileResponse) Valid(version ofxVersion) (bool, error) {
	if ok, err := pr.TrnUID.Valid(); !ok {
		return false, err
	}
	//TODO implement
	return true, nil
}