xxHash32 - ActiveState ActiveGo 1.8
...

Package xxHash32

import "github.com/pierrec/xxHash/xxHash32"
Overview
Index
Examples

Overview ▾

Package xxHash32 implements the very fast xxHash hashing algorithm (32 bits version). (https://github.com/Cyan4973/xxHash/)

func Checksum

func Checksum(input []byte, seed uint32) uint32

Checksum returns the 32bits Hash value.

Example

Code:

buf := bytes.NewBufferString("this is a test")
fmt.Printf("%x\n", xxHash32.Checksum(buf.Bytes(), 0xCAFE))

Output:

bb4f02bc

func New

func New(seed uint32) hash.Hash32

New returns a new Hash32 instance.

Example

Code:

buf := bytes.NewBufferString("this is a test")
x := xxHash32.New(0xCAFE)
x.Write(buf.Bytes())
fmt.Printf("%x\n", x.Sum32())

Output:

bb4f02bc