// Sum returns the hash as a byte slice
435887
func (d *Buzhash64) Sum(b []byte) []byte {
	v := d.Sum64()
	return append(b, byte(v>>56), byte(v>>48), byte(v>>40), byte(v>>32), byte(v>>24), byte(v>>16), byte(v>>8), byte(v))
}
1273440
func (m *murmur32) Sum32() (hash uint32) {
	hash, _ = mmix(m.hash, m.tail)
	hash, _ = mmix(hash, m.size)

	hash ^= hash >> 13
	hash *= M
	hash ^= hash >> 15

	return
}
9912
func (d *State364) Sum64() uint64 {
	d.pc, d.pb = Jenkins364(d.tail, len(d.tail), d.pc, d.pb)
	d.hash = uint64(d.pb)<<32 | uint64(d.pc)
	return d.hash
}
618196
func hash(s string) uint32 {
	h := fnv.New32a()
	if _, err := h.Write([]byte(s)); err != nil {
		log.Println("[ERROR] failed to write bytes: ", err)
	}
	return h.Sum32()
}
15050
func (m *MemEngine) Hash(_ context.Context, d []byte) Hash {
	sum := sha512.Sum512(d)
	return Hash(sum[:])
}
1277657
func Sum(input Float64Data) (sum float64, err error) {

	if input.Len() == 0 {
		return math.NaN(), EmptyInputErr
	}

	// Add em up
	for _, n := range input {
		sum += n
	}

	return sum, nil
}
850957
func (d *RabinKarp64) Sum(b []byte) []byte {
	v := d.Sum64()
	return append(b, byte(v>>56), byte(v>>48), byte(v>>40), byte(v>>32), byte(v>>24), byte(v>>16), byte(v>>8), byte(v))
}
68781
func (h *Hash) Sum64() (uint64, bool) {
	h64, ok := h.Hash.(hash.Hash64)
	if !ok {
		return 0, false
	}

	return h64.Sum64(), true
}
241510
func Sum256(data []byte) (digest [32]byte) {
	h := New256()
	h.Write(data)
	h.Sum(digest[:0])
	return
}
873290
func Hash(h crypto.Hash, src io.Reader) (HexDigest, error) {
	a := h.New()
	_, err := io.Copy(a, src)
	if err != nil {
		return HexDigest(""), err
	}
	return Sum(a), nil
}
370573
func (d *State364) Sum(b []byte) []byte {
	d.pc, d.pb = Jenkins364(d.tail, len(d.tail), d.pc, d.pb)
	d.hash = uint64(d.pb<<32) | uint64(d.pc)
	h := d.hash
	return append(b, byte(h>>56), byte(h>>48), byte(h>>40), byte(h>>32), byte(h>>24), byte(h>>16), byte(h>>8), byte(h))
}
749197
func (sm3 *SM3) Sum(in []byte) []byte {
	sm3.Write(in)
	msg := sm3.pad()

	// Finialize
	sm3.update(msg, len(msg)/sm3.BlockSize())

	// save hash to in
	needed := sm3.Size()
	if cap(in)-len(in) < needed {
		newIn := make([]byte, len(in), len(in)+needed)
		copy(newIn, in)
		in = newIn
	}
	out := in[len(in) : len(in)+needed]

	for i := 0; i < 8; i++ {
		binary.BigEndian.PutUint32(out[i*4:], sm3.digest[i])
	}
	return out

}
931130
func Hash(hasher hash.Hash, path string) ([]byte, error) {
	f, err := os.Open(path)
	if err != nil {
		return nil, err
	}
	defer f.Close()

	if _, err := io.Copy(hasher, f); err != nil {
		return nil, err
	}
	return hasher.Sum(nil), nil
}
322999
func Sum(m []byte, key nacl.Key) *[Size]byte {
	mac := hmac.New(sha512.New, (*key)[:])
	mac.Write(m)
	sum := mac.Sum(nil) // first 256 bits of 512 bit sum
	out := new([32]byte)
	copy(out[:], sum[:32])
	return out
}
1075283
func doSum(h hash.Hash, b []byte, data ...[]byte) []byte {
	h.Reset()
	for _, v := range data {
		h.Write(v)
	}
	return h.Sum(b)
}
1208008
func (p *Hash) Sum(b []byte) []byte {
	var out [TagSize]byte
	h := p.h

	if p.off > 0 {
		var buf [TagSize]byte
		copy(buf[:], p.buf[:p.off])
		buf[p.off] = 1 // invariant: p.off < TagSize

		update(buf[:], finalBlock, &h, &(p.r))
	}

	finalize(&out, &h, &(p.s))
	p.done = true
	return append(b, out[:]...)
}
852275
func Sum(out *[TagSize]byte, msg []byte, key *[16]byte) {
	r := Sum64(msg, key)

	out[0] = byte(r)
	out[1] = byte(r >> 8)
	out[2] = byte(r >> 16)
	out[3] = byte(r >> 24)
	out[4] = byte(r >> 32)
	out[5] = byte(r >> 40)
	out[6] = byte(r >> 48)
	out[7] = byte(r >> 56)
}