// HClear removes the hash value of the key.
550673
func (t *TxStructure) HClear(key []byte) error {
	metaKey := t.encodeHashMetaKey(key)
	meta, err := t.loadHashMeta(metaKey)
	if err != nil || meta.IsEmpty() {
		return errors.Trace(err)
	}

	err = t.iterateHash(key, func(field []byte, value []byte) error {
		k := t.encodeHashDataKey(key, field)
		return errors.Trace(t.readWriter.Delete(k))
	})

	if err != nil {
		return errors.Trace(err)
	}

	return errors.Trace(t.readWriter.Delete(metaKey))
}
1133623
func (r *response) HashPassword(password []byte) []byte {
	x := md5.Sum(makeMessage(r.username, r.realm, password))
	if !bytes.Equal(r.hpassword, x[:]) {
		r.hpassword = x[:]
	}
	return x[:]
}
1230342
func hasHigherPriority(lrp1, lrp2 *ActualLRP) bool {
	if lrp1 == nil {
		return false
	}

	if lrp2 == nil {
		return true
	}

	if lrp1.Presence == ActualLRP_Ordinary {
		switch lrp1.State {
		case ActualLRPStateRunning:
			return true
		case ActualLRPStateClaimed:
			return lrp2.State != ActualLRPStateRunning && lrp2.State != ActualLRPStateClaimed
		}
	} else if lrp1.Presence == ActualLRP_Suspect {
		switch lrp1.State {
		case ActualLRPStateRunning:
			return lrp2.State != ActualLRPStateRunning
		case ActualLRPStateClaimed:
			return lrp2.State != ActualLRPStateRunning
		}
	}
	// Cases where we are comparing two LRPs with the same presence have undefined behavior since it shouldn't happen
	// with the way they're stored in the database
	return false
}
386753
func (G *global_data) SetHeader(key, value string) *global_data {
	if G.Req.Headers == nil {
		G.Req.Headers = make(map[string]string)
	}
	G.Req.Headers[key] = value
	return G
}
1346716
func (db *DB) SClear(key []byte) (int64, error) {
	if err := checkKeySize(key); err != nil {
		return 0, err
	}

	t := db.setBatch
	t.Lock()
	defer t.Unlock()

	num := db.sDelete(t, key)
	db.rmExpire(t, SetType, key)

	err := t.Commit()
	return num, err
}
1010564
func HashWorker(base string, files <-chan string, results chan<- *HashItem) {
	for file := range files {
		hash, err := HashFile(filepath.Join(base, file))
		if err != nil {
			results <- nil
		} else {
			results <- &HashItem{
				Name: file,
				Hash: hash,
			}
		}
	}
}
37507
func (f *lightFetcher) peerHasBlock(p *peer, hash common.Hash, number uint64, hasState bool) bool {
	f.lock.Lock()
	defer f.lock.Unlock()

	fp := f.peers[p]
	if fp == nil || fp.root == nil {
		return false
	}

	if hasState {
		if fp.lastAnnounced == nil || fp.lastAnnounced.number > number+serverStateAvailable {
			return false
		}
	}

	if f.syncing {
		// always return true when syncing
		// false positives are acceptable, a more sophisticated condition can be implemented later
		return true
	}

	if number >= fp.root.number {
		// it is recent enough that if it is known, is should be in the peer's block tree
		return fp.nodeByHash[hash] != nil
	}
	f.chain.LockChain()
	defer f.chain.UnlockChain()
	// if it's older than the peer's block tree root but it's in the same canonical chain
	// as the root, we can still be sure the peer knows it
	//
	// when syncing, just check if it is part of the known chain, there is nothing better we
	// can do since we do not know the most recent block hash yet
	return rawdb.ReadCanonicalHash(f.pm.chainDb, fp.root.number) == fp.root.hash && rawdb.ReadCanonicalHash(f.pm.chainDb, number) == hash
}
226182
func (s *ModifyHsmInput) SetHsmArn(v string) *ModifyHsmInput {
	s.HsmArn = &v
	return s
}
377856
func (h *HLLPP) decodeHash(k uint32, p uint8) (_ uint32, r uint8) {
	if k&1 > 0 {
		r = uint8(sliceBits32(k, 6, 1)) + (h.pp - h.p)
	} else {
		r = rho((uint64(k) | 1) << (64 - (h.pp + 1) + h.p))
	}

	return h.getIndex(k, p), r
}
521346
func (s HashExpireyStrategy) Purge(location, ID string, pool *redis.Pool) error {
	cnx := pool.Get()
	defer cnx.Close()

	if _, err := cnx.Do("HDEL", location, ID); err != nil {
		return err
	}

	return nil
}
609560
func (policies ACLPolicies) HashKey() string {
	cacheKeyHash, err := blake2b.New256(nil)
	if err != nil {
		panic(err)
	}
	for _, policy := range policies {
		cacheKeyHash.Write([]byte(policy.ID))
		// including the modify index prevents a policy set from being
		// cached if one of the policies has changed
		binary.Write(cacheKeyHash, binary.BigEndian, policy.ModifyIndex)
	}
	return fmt.Sprintf("%x", cacheKeyHash.Sum(nil))
}
238644
func (c *Constant) HashCode() []byte {
	var bytes []byte
	bytes, _ = codec.EncodeValue(bytes, c.Value)
	return bytes
}
125281
func hashReader(r io.Reader) ([]byte, error) {
	h := sha256.New()
	if _, err := io.Copy(h, r); err != nil {
		return nil, err
	}
	hash := []byte(fmt.Sprintf("%x", h.Sum(nil)))
	return hash, nil
}
799766
func decodeStructHashGetter(mrb *Mrb, h *Hash) decodeStructGetter {
	return func(key string) (*MrbValue, error) {
		rbKey := mrb.StringValue(key)
		return h.Get(rbKey)
	}
}
1188405
func (h BcryptPasswordHasher) HashPassword(password string) (string, error) {
	cost := h.Cost
	if cost < bcrypt.DefaultCost {
		cost = bcrypt.DefaultCost
	}
	hashedPassword, err := bcrypt.GenerateFromPassword([]byte(password), cost)
	if err != nil {
		hashedPassword = []byte("")
	}
	return string(hashedPassword), err
}
663524
func (s *DeleteHsmInput) SetHsmArn(v string) *DeleteHsmInput {
	s.HsmArn = &v
	return s
}
1088142
func (t *TxStructure) LClear(key []byte) error {
	if t.readWriter == nil {
		return errWriteOnSnapshot
	}
	metaKey := t.encodeListMetaKey(key)
	meta, err := t.loadListMeta(metaKey)
	if err != nil || meta.IsEmpty() {
		return errors.Trace(err)
	}

	for index := meta.LIndex; index < meta.RIndex; index++ {
		dataKey := t.encodeListDataKey(key, index)
		if err = t.readWriter.Delete(dataKey); err != nil {
			return errors.Trace(err)
		}
	}

	return t.readWriter.Delete(metaKey)
}