示例#1
0
// NewS64 creates a new hash.Hash64 computing the 64bit xxHash checksum starting with the specific seed.
func NewS64(seed uint64) hash.Hash64 {
	h := &xxHash64{
		seed: seed,
	}
	h.Reset()
	runtime.SetFinalizer(h, func(h *xxHash64) {
		C.XXH64_digest(h.state)
	})

	return h
}
示例#2
0
func (xx *XXHash64) Sum64() uint64 {
	return uint64(C.XXH64_digest(&xx.state))
}
示例#3
0
// Reset resets the Hash to its initial state.
func (xx *xxHash64) Reset() {
	if xx.state != nil {
		C.XXH64_digest(xx.state)
	}
	xx.state = C.XXH64_init(C.ulonglong(xx.seed))
}