xxhash

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

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

Go to latest
Published: Mar 13, 2013 License: MIT Imports: 3 Imported by: 0

README

xxhash

xxhash is a pure go (golang) implementation of xxhash.

Benchmark

go test github.com/vova616/xxhash -bench=".*"

Core i7-3770K CPU @ 3.50GHz go version devel +16e0e01c2e9b Sat Mar 09 18:14:00 2013 -0800 windows/386

Benchmark_xxhash32     			50000000     61.1 ns/op
Benchmark_CRC32IEEE    			10000000      145 ns/op
Benchmark_Adler32      	 		10000000      181 ns/op
Benchmark_Fnv32 				10000000      162 ns/op
Benchmark_MurmurHash3Hash32     1000000      1927 ns/op

Note:

The package uses unsafe to get higher performance its safe as far as I know but if you don't want it you can use switch to early commits.

Documentation

Index

Constants

View Source
const (
	PRIME32_1 = 2654435761
	PRIME32_2 = 2246822519
	PRIME32_3 = 3266489917
	PRIME32_4 = 668265263
	PRIME32_5 = 374761393
)

Variables

This section is empty.

Functions

func Checksum32

func Checksum32(data []byte) uint32

Checksum32Seed returns the xxhash32 checksum of data using a seed. Length of data MUST BE less than 2 Gigabytes.

func Checksum32Seed

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

Checksum32 returns the xxhash32 checksum of data. Length of data MUST BE less than 2 Gigabytes.

func New

func New(seed uint32) hash.Hash32

Types

type XXHash

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

func (*XXHash) BlockSize

func (self *XXHash) BlockSize() int

func (*XXHash) Reset

func (self *XXHash) Reset()

func (*XXHash) Size

func (self *XXHash) Size() int

Size returns the number of bytes Sum will return.

func (*XXHash) Sum

func (self *XXHash) Sum(in []byte) []byte

func (*XXHash) Sum32

func (self *XXHash) Sum32() uint32

func (*XXHash) Write

func (self *XXHash) Write(data []byte) (nn int, err error)

Write adds more data to the running hash. Length of data MUST BE less than 1 Gigabytes.

Jump to

Keyboard shortcuts

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