Example #1
0
// NewS32 creates a new hash.Hash32 computing the 32bit xxHash checksum starting with the specific seed.
func NewS32(seed uint32) hash.Hash32 {
	h := &xxHash32{
		seed: seed,
	}
	h.Reset()
	runtime.SetFinalizer(h, func(h *xxHash32) {
		C.XXH32_digest(h.state)
	})
	return h
}
Example #2
0
func (xx *XXHash32) Sum32() uint32 {
	return uint32(C.XXH32_digest(&xx.state))
}
Example #3
0
// Reset resets the Hash to its initial state.
func (xx *xxHash32) Reset() {
	if xx.state != nil {
		C.XXH32_digest(xx.state)
	}
	xx.state = C.XXH32_init(C.uint(xx.seed))
}