Documentation ¶
Overview ¶
Package murmur3 provides an amd64 native (Go generic fallback) implementation of the murmur3 hash algorithm for strings and slices.
Assembly is provided for amd64 go1.5+; pull requests are welcome for other architectures.
Index ¶
- func New32() hash.Hash32
- func New64() hash.Hash64
- func SeedNew32(seed uint32) hash.Hash32
- func SeedNew64(seed uint64) hash.Hash64
- func SeedStringSum128(seed1, seed2 uint64, data string) (h1 uint64, h2 uint64)
- func SeedStringSum32(seed uint32, data string) (h1 uint32)
- func SeedStringSum64(seed uint64, data string) uint64
- func SeedSum128(seed1, seed2 uint64, data []byte) (h1 uint64, h2 uint64)
- func SeedSum32(seed uint32, data []byte) (h1 uint32)
- func SeedSum64(seed uint64, data []byte) uint64
- func StringSum128(data string) (h1 uint64, h2 uint64)
- func StringSum32(data string) uint32
- func StringSum64(data string) uint64
- func Sum128(data []byte) (h1 uint64, h2 uint64)
- func Sum32(data []byte) uint32
- func Sum64(data []byte) uint64
- type Hash128
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SeedNew32 ¶
SeedNew32 returns a hash.Hash32 for streaming 32 bit sums with its internal digest initialized to seed.
This reads and processes the data in chunks of little endian uint32s; thus, the returned hash is portable across architectures.
func SeedNew64 ¶
SeedNew64 returns a hash.Hash64 for streaming 64 bit sums. As the canonical implementation does not support Sum64, this uses SeedNew128(seed, seed)
func SeedStringSum128 ¶
SeedStringSum128 is the string version of SeedSum128.
func SeedStringSum32 ¶
SeedStringSum32 is the string version of SeedSum32.
func SeedStringSum64 ¶
SeedStringSum64 is the string version of SeedSum64.
func SeedSum128 ¶
SeedSum128 returns the murmur3 sum of data with digests initialized to seed1 and seed2.
The canonical implementation allows only one uint32 seed; to imitate that behavior, use the same, uint32-max seed for seed1 and seed2.
This reads and processes the data in chunks of little endian uint64s; thus, the returned hashes are portable across architectures.
func SeedSum32 ¶
SeedSum32 returns the murmur3 sum of data with the digest initialized to seed.
This reads and processes the data in chunks of little endian uint32s; thus, the returned hash is portable across architectures.
func SeedSum64 ¶
SeedSum64 returns the murmur3 sum of data with the digest initialized to seed.
Because the canonical implementation does not support SeedSum64, this uses SeedSum128(seed, seed, data).
func StringSum128 ¶
StringSum128 is the string version of Sum128.
func Sum128 ¶
Sum128 returns the murmur3 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()
Types ¶
type Hash128 ¶
Hash128 provides an interface for a streaming 128 bit hash.
func SeedNew128 ¶
SeedNew128 returns a Hash128 for streaming 128 bit sums with its internal digests initialized to seed1 and seed2.
The canonical implementation allows one only uint32 seed; to imitate that behavior, use the same, uint32-max seed for seed1 and seed2.