// HashKey computes a hash of key. Hash is always non-zero.
351891
func HashKey(key []byte) int64 {
	h := int64(xxhash.Sum64(key))
	if h == 0 {
		h = 1
	} else if h < 0 {
		h = 0 - h
	}
	return h
}
586171
func (num Number) Hash() int {
	f, err := json.Number(num).Float64()
	if err != nil {
		bs := []byte(num)
		h := xxhash.Checksum64(bs)
		return int(h)
	}
	return int(f)
}
950897
func (idx *index) idByKey(key []byte) (uint64, bool) {
	hash := hashKey(key)
	pos := hash & idx.mask

	var dist uint64
	for {
		if e := &idx.elems[pos]; e.hash == 0 {
			return 0, false
		} else if dist > idx.dist(e.hash, pos) {
			return 0, false
		} else if e.hash == hash && bytes.Equal(idx.lookupKey(e.offset), key) {
			return e.id, true
		}

		pos = (pos + 1) & idx.mask
		dist++
	}
}
15050
func (m *MemEngine) Hash(_ context.Context, d []byte) Hash {
	sum := sha512.Sum512(d)
	return Hash(sum[:])
}
170780
func (m *HashMap) DelHashedKey(hashedKey uintptr) {
	list := m.list()
	if list == nil {
		return
	}

	_, element := m.indexElement(hashedKey)
	if element == nil {
		return
	}

	m.deleteElement(element)
	list.Delete(element)
}
884682
func (t *table) hash(s string) (h1, h2 uint32) {
	h := fnv(t.h0, s)
	h1 = h & t.mask
	h2 = (h >> 16) & t.mask
	return
}
1241006
func (blockID BlockID) Key() string {
	bz, err := cdc.MarshalBinaryBare(blockID.PartsHeader)
	if err != nil {
		panic(err)
	}
	return string(blockID.Hash) + string(bz)
}
689684
func (oc *ObjectComprehension) Hash() int {
	return oc.Key.Hash() + oc.Value.Hash() + oc.Body.Hash()
}
1287467
func (data *Data) Hash() cmn.HexBytes {
	if data == nil {
		return (Txs{}).Hash()
	}
	if data.hash == nil {
		data.hash = data.Txs.Hash() // NOTE: leaves of merkle tree are TxIDs
	}
	return data.hash
}
328548
func (obj *object) Hash() int {
	var hash int
	obj.Foreach(func(k, v *Term) {
		hash += k.Value.Hash()
		hash += v.Value.Hash()
	})
	return hash
}
1158618
func Key(key ...string) string {
	keychain := append(rootChain, key...)
	str := strings.Join(keychain, "/")
	return str + "/"
}
909125
func (rh *RefHasher) Hash(data []byte) []byte {
	// if data is shorter than the base length (maxDataLength), we provide padding with zeros
	d := make([]byte, rh.maxDataLength)
	length := len(data)
	if length > rh.maxDataLength {
		length = rh.maxDataLength
	}
	copy(d, data[:length])
	return rh.hash(d, rh.maxDataLength)
}
18095
func (h Hash) String(key string) (string, error) {
	if value, ok := h[key]; ok {
		return value.String(), nil
	}
	return "", errors.New(ErrInvalidKey, errorMessages, key)
}
942631
func (it *iterator) Key() []byte {
	if len(it.keys) > 0 {
		return []byte(it.keys[0])
	}
	return nil
}
1100106
func (b *Block) Hash() *chainhash.Hash {
	// Return the cached block hash if it has already been generated.
	if b.blockHash != nil {
		return b.blockHash
	}

	// Cache the block hash and return it.
	hash := b.msgBlock.BlockHash()
	b.blockHash = &hash
	return &hash
}
810671
func (s *xorKeySpace) Key(id []byte) Key {
	hash := sha256.Sum256(id)
	key := hash[:]
	return Key{
		Space:    s,
		Original: id,
		Bytes:    key,
	}
}
334276
func (d *MyDecimal) ToHashKey() ([]byte, error) {
	_, digitsInt := d.removeLeadingZeros()
	_, digitsFrac := d.removeTrailingZeros()
	prec := digitsInt + digitsFrac
	if prec == 0 { // zeroDecimal
		prec = 1
	}
	buf, err := d.ToBin(prec, digitsFrac)
	if err == ErrTruncated {
		// This err is caused by shorter digitsFrac;
		// After removing the trailing zeros from a Decimal,
		// so digitsFrac may be less than the real digitsFrac of the Decimal,
		// thus ErrTruncated may be raised, we can ignore it here.
		err = nil
	}
	return buf, err
}