Пример #1
0
func SeedSum128(seed uint32, data []byte) (h1, h2 uint64) {
	header := *(*reflect.SliceHeader)(unsafe.Pointer(&data))
	var out struct {
		h1 uint64
		h2 uint64
	}
	C.MurmurHash3_x64_128(unsafe.Pointer(header.Data), C.int(len(data)), C.uint32_t(seed), unsafe.Pointer(&out))
	return out.h1, out.h2
}
Пример #2
0
// Extrude will fill the provided slice with the hash for all consumed data.
// Extrude is slightly less allocating than Get, if that kind of thing is of interest.
func (self *Hash) Extrude(result *[]byte) {
	buf := (*bytes.Buffer)(self).Bytes()
	C.MurmurHash3_x64_128(
		*(*unsafe.Pointer)(unsafe.Pointer(&buf)),
		C.int(len(buf)),
		C.uint32_t(seed),
		*(*unsafe.Pointer)(unsafe.Pointer(result)))
	self.Reset()
}
Пример #3
0
func hash64(key unsafe.Pointer, length C.int, seed C.uint32_t, out unsafe.Pointer) {
	C.MurmurHash3_x64_128(key, length, seed, out)
}