wyhash

package
v1.2.12 Latest Latest
Warning

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

Go to latest
Published: Mar 2, 2024 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package wyhash implements https://github.com/wangyi-fudan/wyhash

Index

Constants

View Source
const (
	DefaultSeed = 0xa0761d6478bd642f // s0

)

Variables

This section is empty.

Functions

func Sum64

func Sum64(data []byte) uint64

func Sum64String

func Sum64String(data string) uint64

func Sum64StringWithSeed

func Sum64StringWithSeed(data string, seed uint64) uint64

func Sum64WithSeed

func Sum64WithSeed(data []byte, seed uint64) uint64

Types

type Digest

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

func New

func New(seed uint64) *Digest

New creates a new Digest that computes the 64-bit wyhash algorithm.

func NewDefault

func NewDefault() *Digest

func (*Digest) BlockSize

func (d *Digest) BlockSize() int

BlockSize always returns 64 bytes.

func (*Digest) InitSeed

func (d *Digest) InitSeed() uint64

func (*Digest) Reset

func (d *Digest) Reset()

Reset the digest, and the seed will be reset to initseed. The initseed is the seed when digest has been created.

func (*Digest) Seed

func (d *Digest) Seed() uint64

func (*Digest) SetInitSeed

func (d *Digest) SetInitSeed(seed uint64)

func (*Digest) SetSeed

func (d *Digest) SetSeed(seed uint64)

func (*Digest) Size

func (d *Digest) Size() int

Size always returns 8 bytes.

func (*Digest) Sum

func (d *Digest) Sum(b []byte) []byte

Sum appends the current hash to b and returns the resulting slice.

func (*Digest) Sum64

func (d *Digest) Sum64() uint64

Sum64 returns the current hash.

func (*Digest) Write

func (d *Digest) Write(input []byte) (int, error)

Write (via the embedded io.Writer interface) adds more data to the running hash. It never returns an error.

Jump to

Keyboard shortcuts

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