murmur3

package module
v0.0.0-...-e9012b2 Latest Latest
Warning

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

Go to latest
Published: Jan 26, 2021 License: BSD-2-Clause Imports: 3 Imported by: 0

README

murmur3

murmur3 hash algorithm

分布式哈希算法

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New32

func New32() hash.Hash32

New32 returns new 32-bit hasher

func New32WithSeed

func New32WithSeed(seed uint32) hash.Hash32

New32WithSeed returns new 32-bit hasher set with explicit seed value

func New64

func New64() hash.Hash64

New64 returns a 64-bit hasher

func New64WithSeed

func New64WithSeed(seed uint32) hash.Hash64

New64WithSeed returns a 64-bit hasher set with explicit seed value

func Sum128

func Sum128(data []byte) (h1 uint64, h2 uint64)

Sum128 returns the MurmurHash3 sum of data. It is equivalent to the following sequence (without the extra burden and the extra allocation):

hasher := New128()
hasher.Write(data)
return hasher.Sum128()

func Sum128WithSeed

func Sum128WithSeed(data []byte, seed uint32) (h1 uint64, h2 uint64)

Sum128WithSeed returns the MurmurHash3 sum of data. It is equivalent to the following sequence (without the extra burden and the extra allocation):

hasher := New128WithSeed(seed)
hasher.Write(data)
return hasher.Sum128()

func Sum32

func Sum32(data []byte) uint32

Sum32 returns the MurmurHash3 sum of data. It is equivalent to the following sequence (without the extra burden and the extra allocation):

hasher := New32()
hasher.Write(data)
return hasher.Sum32()

func Sum32WithSeed

func Sum32WithSeed(data []byte, seed uint32) uint32

Sum32WithSeed returns the MurmurHash3 sum of data. It is equivalent to the following sequence (without the extra burden and the extra allocation):

hasher := New32WithSeed(seed)
hasher.Write(data)
return hasher.Sum32()

func Sum64

func Sum64(data []byte) uint64

Sum64 returns the MurmurHash3 sum of data. It is equivalent to the following sequence (without the extra burden and the extra allocation):

hasher := New64()
hasher.Write(data)
return hasher.Sum64()

func Sum64WithSeed

func Sum64WithSeed(data []byte, seed uint32) uint64

Sum64WithSeed returns the MurmurHash3 sum of data. It is equivalent to the following sequence (without the extra burden and the extra allocation):

hasher := New64WithSeed(seed)
hasher.Write(data)
return hasher.Sum64()

Types

type Hash128

type Hash128 interface {
	hash.Hash
	Sum128() (uint64, uint64)
}

Hash128 represents a 128-bit hasher Hack: the standard api doesn't define any Hash128 interface.

func New128

func New128() Hash128

New128 returns a 128-bit hasher

func New128WithSeed

func New128WithSeed(seed uint32) Hash128

New128WithSeed returns a 128-bit hasher set with explicit seed value

Jump to

Keyboard shortcuts

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