mmh3

package module
v0.0.0-...-012dc69 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 22, 2021 License: MIT Imports: 5 Imported by: 2 modules, 2 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

mmh3

mmh3 implements murmurhash3 32 and 128 bit variants in pure Go.

This version of the library also has a x64 little-endian specific Hash128x64 function, which is ~8x faster amd64 machines.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Hash32

func Hash32(key []byte) uint32

func Hash128x64

func Hash128x64(key []byte) []byte

Hash128x64 calls WriteHash128x64 with an allocated output buffer

func WriteHash128x64

func WriteHash128x64(key, ret []byte)

WriteHash128x64 creates a hash of key and writes it to ret

Types

type Hash128Value

type Hash128Value struct {
	// contains filtered or unexported fields
}

func Hash128

func Hash128(key []byte) Hash128Value

Hash128 s a version of MurmurHash which is designed to run only on little-endian processors

func (Hash128Value) Bytes

func (h Hash128Value) Bytes() []byte

Bytes returns the 16 bytes that compose the hash

func (Hash128Value) Values

func (h Hash128Value) Values() (uint64, uint64)

Values returns the two 8 byte values that compose the hash

func (Hash128Value) Write

func (h Hash128Value) Write(out []byte)

Write writes the hash to given buffer which should be 16 bytes long

type HashWriter128

type HashWriter128 struct {
	// contains filtered or unexported fields
}

func (*HashWriter128) AddBytes

func (hw *HashWriter128) AddBytes(input []byte)

AddBytes adds the given bytes to the hash

func (*HashWriter128) AddString

func (hw *HashWriter128) AddString(key string)

AddString adds the given string to the hash

func (*HashWriter128) BlockSize

func (hw *HashWriter128) BlockSize() int

func (*HashWriter128) Reset

func (hw *HashWriter128) Reset()

func (*HashWriter128) Size

func (hw *HashWriter128) Size() int

func (*HashWriter128) Sum

func (hw *HashWriter128) Sum(b []byte) []byte

Sum completes the hash and _appends_ the hash to the given input buffer This is kept for backwards compatibility

func (*HashWriter128) Sum128

func (hw *HashWriter128) Sum128() Hash128Value

Sum completes the hash value and returns it. Reset should be called after calling Sum

func (*HashWriter128) Write

func (hw *HashWriter128) Write(b []byte) (int, error)

Write writes the given bytes to the hash

func (*HashWriter128) WriteString

func (hw *HashWriter128) WriteString(s string) (int, error)

WriteString writes the given string to the hash

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
⌂ 换网址