murmur3

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

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

Go to latest
Published: Mar 12, 2019 License: ISC Imports: 2 Imported by: 1

README

MurmurHash3

A Golang Implementation of MurmurHash3.

CircleCI codecov Go Report Card LICENSE

Overview

Murmur3 is the 3rd version of MurmurHash by Austin Appleby. As described in wiki, it serves as a general hash-table lookup algorithm. When it comes to need of a cryptographic hash function, this should be definitely out of your choice.

Requirement

  • go-1.11

Installation

go get -u -v github.com/sammyne/murmur3

References

Documentation

Overview

Package murmur3 implements Austin Appleby's non-cryptographic MurmurHash3

Index

Constants

View Source
const (
	C1 = 0xcc9e2d51
	C2 = 0x1b873593
	R1 = 15
	R2 = 13
	M  = 5
	N  = 0xe6546b64

	// extra constants
	D1 = 0x85ebca6b
	D2 = 0xc2b2ae35
)

configuration contants for 32-bit hashing

View Source
const (
	CC1 uint64 = 0x87c37b91114253d5
	CC2 uint64 = 0x4cf5ad432745937f

	RR11 = 31
	RR12 = 33
	RR21 = 27
	RR22 = 31

	NN1 = 0x52dce729
	NN2 = 0x38495ab5

	DD1 uint64 = 0xff51afd7ed558ccd
	DD2 uint64 = 0xc4ceb9fe1a85ec53
)

constants enumeration for x64-128bit

Variables

This section is empty.

Functions

func FinalizeMix64

func FinalizeMix64(h uint64) uint64

FinalizeMix64 is a bit finalizer obfuscating a 64-bit integer

func FinalizeMix86

func FinalizeMix86(h uint32) uint32

FinalizeMix86 is a bit finalizer obfuscating a 32-bit integer

func Sum32

func Sum32(data []byte, seed uint32) [4]byte

Sum32 serves an alias as SumUint32 but with the hashed data encoded as a 4-byte little-endian byte sequences

func Sum128

func Sum128(data []byte, seed uint32) [16]byte

Sum128 calculates the MurmurHash3 sum of data

func SumUint32

func SumUint32(key []byte, seed uint32) uint32

SumUint32 hashes the given 32-bit seed with the key block into a new 32-bit integer, based on the snippet as

key *= C1
key = rotl(key, R1)
key *= C2

hash ^= k

hash = rotl(hash, R1)
hash = hash*M+N

Types

This section is empty.

Directories

Path Synopsis
Package x86 implements the MurmurHash3 optimized specifically for x86 arch
Package x86 implements the MurmurHash3 optimized specifically for x86 arch

Jump to

Keyboard shortcuts

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