// Sum returns the Skein512 checksum with the given hash size of msg using the (optional)
// conf for configuration. The hashsize must be > 0.
422404
func Sum(msg []byte, hashsize int, conf *Config) []byte {
	s := New(hashsize, conf)
	s.Write(msg)
	return s.Sum(nil)
}
895233
func Sum512_256(data []byte) (sum256 [Size256]byte) {
	d := digest{function: crypto.SHA512_256}
	d.Reset()
	d.Write(data)
	sum := d.checkSum()
	copy(sum256[:], sum[:Size256])
	return
}
635158
func (c *ChecksumWriter) Sum() ChecksumInfo {
	c.sum.MD5 = fmt.Sprintf("%x", c.hashes[0].Sum(nil))
	c.sum.SHA1 = fmt.Sprintf("%x", c.hashes[1].Sum(nil))
	c.sum.SHA256 = fmt.Sprintf("%x", c.hashes[2].Sum(nil))

	return c.sum
}
879845
func (p *Hash) Sum(out *[TagSize]byte) {
	h, r := p.h, p.r
	pad := p.pad

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

		core(buf[:], finalBlock, &h, &r)
	}

	finalize(out, &h, &pad)
	p.done = true
}
776524
func Sum512(out *[64]byte, msg, key []byte) {
	var (
		hVal  [8]uint64
		ctr   [2]uint64
		block [blake2b.BlockSize]byte
		off   int
	)
	hVal = hVal512

	if k := len(key); k > 0 {
		hVal[0] ^= uint64(k) << 8 // mixin key-length

		copy(block[:], key)
		off = blake2b.BlockSize
		if len(msg) > 0 {
			blake2b.Core(&hVal, &ctr, blake2b.MsgFlag, block[:])
			off = 0
		}
	}

	if length := len(msg); length > blake2b.BlockSize {
		n := length & (^(blake2b.BlockSize - 1)) // length -= (length % BlockSize)
		if length == n {
			n -= blake2b.BlockSize
		}
		blake2b.Core(&hVal, &ctr, blake2b.MsgFlag, msg[:n])
		msg = msg[n:]
	}

	if len(msg) > 0 {
		off += copy(block[:], msg)
	}

	blake2b.ExtractHash(out, &hVal, &ctr, &block, off)
}
1303414
func (xxh xxHash) Sum(b []byte) []byte {
	h32 := xxh.Sum32()
	return append(b, byte(h32), byte(h32>>8), byte(h32>>16), byte(h32>>24))
}
1158179
func (m mathUtil) Sum(values ...float64) float64 {
	var total float64
	for _, v := range values {
		total += v
	}
	return total
}
526904
func Sum64(msg []byte, key *[16]byte) uint64 {
	k0 := *(*uint64)(unsafe.Pointer(&key[0]))
	k1 := *(*uint64)(unsafe.Pointer(&key[8]))

	var hVal [4]uint64
	hVal[0] = k0 ^ c0
	hVal[1] = k1 ^ c1
	hVal[2] = k0 ^ c2
	hVal[3] = k1 ^ c3

	n := len(msg)
	ctr := byte(n)

	if n >= TagSize {
		n &= (^(TagSize - 1))
		core(&hVal, msg[:n])
		msg = msg[n:]
	}

	var block [TagSize]byte
	for i, v := range msg {
		block[i] = v
	}
	block[7] = ctr

	return finalize(&hVal, &block)
}
43508
func (data ChartUints) Sum(s, e int) (sum uint64) {
	if e <= s {
		return 0
	}
	for _, v := range data[s:e] {
		sum += v
	}
	return
}
918958
func Sum64(msg []byte, key *[16]byte) uint64 {
	k0 := uint64(key[0]) | uint64(key[1])<<8 | uint64(key[2])<<16 | uint64(key[3])<<24 |
		uint64(key[4])<<32 | uint64(key[5])<<40 | uint64(key[6])<<48 | uint64(key[7])<<56
	k1 := uint64(key[8]) | uint64(key[9])<<8 | uint64(key[10])<<16 | uint64(key[11])<<24 |
		uint64(key[12])<<32 | uint64(key[13])<<40 | uint64(key[14])<<48 | uint64(key[15])<<56

	var hVal [4]uint64
	hVal[0] = k0 ^ c0
	hVal[1] = k1 ^ c1
	hVal[2] = k0 ^ c2
	hVal[3] = k1 ^ c3

	n := len(msg)
	ctr := byte(n)

	if n >= TagSize {
		n &= (^(TagSize - 1))
		core(&hVal, msg[:n])
		msg = msg[n:]
	}

	var block [TagSize]byte
	for i, v := range msg {
		block[i] = v
	}
	block[7] = ctr

	return finalize(&hVal, &block)
}
315042
func (s *State232) Sum(b []byte) []byte {
	s.hash = Hash232(s.tail, s.seed)
	h := s.hash
	return append(b, byte(h>>24), byte(h>>16), byte(h>>8), byte(h))
}
696513
func Sum512(out *[64]byte, msg, key []byte) {
	var out1024 [128]byte

	s := new(hashFunc)
	s.initialize(64, &skein.Config{Key: key})

	s.Write(msg)

	s.finalizeHash()

	s.output(&out1024, 0)
	copy(out[:], out1024[:64])
}
15050
func (m *MemEngine) Hash(_ context.Context, d []byte) Hash {
	sum := sha512.Sum512(d)
	return Hash(sum[:])
}
1303350
func Sum(data []byte) [Size]byte {
	imo := New()
	return imo.Sum(data)
}
33036
func nodeSum(h hash.Hash, a, b []byte) []byte {
	return sum(h, []byte{1}, a, b)
}
68781
func (h *Hash) Sum64() (uint64, bool) {
	h64, ok := h.Hash.(hash.Hash64)
	if !ok {
		return 0, false
	}

	return h64.Sum64(), true
}
1238253
func Sum(xs []float64) float64 {
	sum := 0.0
	for _, x := range xs {
		sum += x
	}
	return sum
}