// NewHash returns a new Hash from a byte slice.  An error is returned if
// the number of bytes passed in is not HashSize.
489960
func NewHash(newHash []byte) (*Hash, error) {
	var sh Hash
	err := sh.SetBytes(newHash)
	if err != nil {
		return nil, err
	}
	return &sh, err
}
518197
func Hash(what []byte) uint32 {
	h := fnv.New32()
	h.Write(what)
	return h.Sum32()
}
1314009
func encodeHash(x uint64, p uint8) uint32 {
	if sliceUint64(x, 63-p, 39) == 0 {
		var result uint32
		result = uint32((x >> 32) &^ 0x7f)
		w := sliceUint64(x, 63-p, 0) << p
		result |= (uint32(bits.LeadingZeros64(w)) << 1)
		result |= 1
		return result
	}
	return uint32(x>>32) &^ 0x1
}
1290147
func hash(s string) string {
	hash := fnv.New32a()
	hash.Write([]byte(s))
	intHash := hash.Sum32()
	result := fmt.Sprintf("%08x", intHash)
	return result
}
390180
func (o *Generator) NewHash(hash hash.Hash, names ...interface{}) UUID {
	id := UUID{}
	id.unmarshal(digest(hash, []byte{}, names...))
	id[versionIndex] &= 0x0f
	id[versionIndex] |= uint8(0 << 4)
	id[variantIndex] &= variantSet
	id[variantIndex] |= VariantFuture
	return id
}
630043
func NewHash(algo api.HashAlgo) (hash.Hash, error) {
	if err := ValidateHashAlgo(algo); err != nil {
		return nil, err
	}
	return supportedAlgos[algo].hash(), nil
}
744993
func ComputeHash(contents []byte, hash []byte) []byte {
	newSlice := make([]byte, len(hash)+len(contents))

	//copy the contents
	copy(newSlice[0:len(contents)], contents[:])

	//add the previous hash
	copy(newSlice[len(contents):], hash[:])

	//compute new hash
	hash = util.ComputeSHA256(newSlice)

	return hash
}
516095
func NewFromHash(hashedKey string) (Crypter, error) {
	var f func() Crypter

	if strings.HasPrefix(hashedKey, cryptPrefixes[SHA512]) {
		f = crypts[SHA512]
	} else if strings.HasPrefix(hashedKey, cryptPrefixes[SHA256]) {
		f = crypts[SHA256]
	} else if strings.HasPrefix(hashedKey, cryptPrefixes[MD5]) {
		f = crypts[MD5]
	} else if strings.HasPrefix(hashedKey, cryptPrefixes[APR1]) {
		f = crypts[APR1]
	}

	if f != nil {
		return f(), nil
	}

	return nil, errors.New("Invalid hash")
}
1179519
func (cm *Meta) writeHash(h hash.Hash) error {
	if _, err := h.Write([]byte{byte(cm.Chunk.Encoding())}); err != nil {
		return err
	}
	if _, err := h.Write(cm.Chunk.Bytes()); err != nil {
		return err
	}
	return nil
}
519587
func fastHash(input []byte) string {
	h := fnv.New32a()
	h.Write([]byte(input))
	return fmt.Sprintf("%x", h.Sum32())
}
32580
func NewMAC(outBytes uint8, key []byte) hash.Hash {
	d, err := New(&Config{Size: outBytes, Key: key})
	if err != nil {
		panic(err.Error())
	}
	return d
}
1093114
func NewHashes(size int) *Hashes {
	return &Hashes{
		hashes: make([]common.Hash, size),
	}
}
758006
func New(key []byte) (hash.Hash, error) {
	if len(key) != Size {
		return nil, errKeySize
	}
	h := &digest{size: Size}
	copy(h.key[:], key)
	h.Reset()
	return h, nil
}
1160238
func New(hashsize int, conf *skein.Config) hash.Hash {
	s := new(hashFunc)
	s.initialize(hashsize, conf)
	return s
}
232640
func (p *parser) parseHash() *ast.Hash {
	var pairs []*ast.HashPair

	for p.isHashSegment() {
		pairs = append(pairs, p.parseHashSegment())
	}

	firstLoc := pairs[0].Location()

	result := ast.NewHash(firstLoc.Pos, firstLoc.Line)
	result.Pairs = pairs

	return result
}
932643
func MixHash(hash uint32, key uint32) uint32 {
	hash ^= key
	hash = rotateLeft(hash, r2)
	hash = hash*m + n
	return hash

}
1067773
func innerHash(left []byte, right []byte) []byte {
	return tmhash.Sum(append(innerPrefix, append(left, right...)...))
}