xxHash32

package
v0.2.7 Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2024 License: Apache-2.0, BSD-3-Clause Imports: 1 Imported by: 0

Documentation

Overview

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

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func Checksum

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

Checksum returns the 32bits Hash value.

Example
package main

import (
	"bytes"
	"fmt"

	"blockwatch.cc/knoxdb/hash/xxHash32"
)

func main() {
	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
package main

import (
	"bytes"
	"fmt"

	"blockwatch.cc/knoxdb/hash/xxHash32"
)

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

bb4f02bc

Types

This section is empty.

Jump to

Keyboard shortcuts

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