// NeedsRehash checks if provided hash needs rehash
486432
func (p *Provider) NeedsRehash(hash []byte) bool {
	hashCost, err := gobcrypt.Cost(hash)
	return err != nil || hashCost != int(p.Cost)
}
998869
func ExtractHash(out *[Size]byte, hVal *[8]uint32, ctr *[2]uint32, block *[BlockSize]byte, off int) {
	diff := uint32(BlockSize - off)
	if ctr[0] < diff {
		ctr[1]--
	}
	ctr[0] -= diff

	for i := off; i < BlockSize; i++ {
		block[i] = 0
	}

	Core(hVal, ctr, FinalFlag, block[:])

	j := 0
	for _, s := range hVal {
		out[j+0] = byte(s >> 0)
		out[j+1] = byte(s >> 8)
		out[j+2] = byte(s >> 16)
		out[j+3] = byte(s >> 24)
		j += 4
	}
}
636212
func hash(rrs []dns.RR) uint32 {
	h := fnv.New32()
	buf := make([]byte, 256)
	for _, r := range rrs {
		off, err := dns.PackRR(r, buf, 0, nil, false)
		if err == nil {
			h.Write(buf[:off])
		}
	}

	i := h.Sum32()
	return i
}
391158
func requiresReplacement(n, o properties) (bool, error) {
	a, err := n.ReplacementHash()
	if err != nil {
		return false, err
	}

	b, err := o.ReplacementHash()
	if err != nil {
		return false, err
	}

	return a != b, nil
}
736396
func hash(rrs []dns.RR) uint64 {
	h := fnv.New64()
	buf := make([]byte, 256)
	for _, r := range rrs {
		off, err := dns.PackRR(r, buf, 0, nil, false)
		if err == nil {
			h.Write(buf[:off])
		}
	}

	i := h.Sum64()
	return i
}
293616
func (c *sha256hash) RequiredGas(input []byte) uint64 {
	return uint64(len(input)+31)/32*params.Sha256PerWordGas + params.Sha256BaseGas
}
319663
func (v *DatabaseVersion) NeededToReach(other *DatabaseVersion) CompatAction {
	switch {
	case v.compat < other.compat:
		return Rebuild
	case v.compat < other.compat:
		return TimeTravel
	case v.schema < other.schema:
		return Upgrade
	case v.schema > other.schema:
		return TimeTravel
	case v.maint < other.maint:
		return Maintenance
	case v.maint > other.maint:
		return TimeTravel
	default:
		return OK
	}
}
932643
func MixHash(hash uint32, key uint32) uint32 {
	hash ^= key
	hash = rotateLeft(hash, r2)
	hash = hash*m + n
	return hash

}
1275434
func (ethash *Ethash) SealHash(header *types.Header) (hash common.Hash) {
	hasher := sha3.NewLegacyKeccak256()

	rlp.Encode(hasher, []interface{}{
		header.ParentHash,
		header.UncleHash,
		header.Coinbase,
		header.Root,
		header.TxHash,
		header.ReceiptHash,
		header.Bloom,
		header.Difficulty,
		header.Number,
		header.GasLimit,
		header.GasUsed,
		header.Time,
		header.Extra,
	})
	hasher.Sum(hash[:0])
	return hash
}
1050181
func (state *UserState) PasswordHash(username string) (string, error) {
	return state.users.Get(username, "password")
}
740252
func (d *AddressCacheItem) BlockHash() chainhash.Hash {
	d.mtx.RLock()
	defer d.mtx.RUnlock()
	return d.hash
}
918003
func (b *Backend) Rehash() uint64 {
	// If we have no backend, the value is zero
	if b == nil {
		return 0
	}

	// Use hashstructure to hash only our type with the config.
	code, err := hashstructure.Hash(map[string]interface{}{
		"type":   b.Type,
		"config": b.RawConfig.Raw,
	}, nil)

	// This should never happen since we have just some basic primitives
	// so panic if there is an error.
	if err != nil {
		panic(err)
	}

	return code
}
704475
func DefaultHash(buf []byte) (Hash, error) {
	hashType, rawHash := DoRawDefaultHash(buf)
	return HashFromRaw(hashType, rawHash[:])
}
1117651
func validateHash(s string) error {
	if len(s) != 2*wire.HashSize {
		return fmt.Errorf("param str bad len")
	}
	return nil
}
73769
func ComputeHash(t ObjectType, content []byte) Hash {
	h := NewHasher(t, int64(len(content)))
	h.Write(content)
	return h.Sum()
}
656601
func (m *MockCryptoSuite) GetHash(opts core.HashOpts) (hash.Hash, error) {
	return sha256.New(), nil
}
916420
func (c *CuckooFilter) computeHash(data []byte) []byte {
	c.hash.Write(data)
	hash := c.hash.Sum(nil)
	c.hash.Reset()
	return hash
}