...

Package xxh3

import "github.com/zeebo/xxh3"
Overview
Index
Subdirectories

Overview ▾

func Hash

func Hash(b []byte) uint64

Hash returns the hash of the byte slice.

func HashSeed

func HashSeed(b []byte, seed uint64) uint64

HashSeed returns the hash of the byte slice with given seed.

func HashString

func HashString(s string) uint64

Hash returns the hash of the string slice.

func HashStringSeed

func HashStringSeed(s string, seed uint64) uint64

HashStringSeed returns the hash of the string slice with given seed.

type Hasher

Hasher implements the hash.Hash interface

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

func New

func New() *Hasher

New returns a new Hasher that implements the hash.Hash interface.

func NewSeed

func NewSeed(seed uint64) *Hasher

NewSeed returns a new Hasher that implements the hash.Hash interface.

func (*Hasher) BlockSize

func (h *Hasher) BlockSize() int

BlockSize returns the hash's underlying block size. The Write method will accept any amount of data, but it may operate more efficiently if all writes are a multiple of the block size.

func (*Hasher) Reset

func (h *Hasher) Reset()

Reset resets the Hash to its initial state.

func (*Hasher) Size

func (h *Hasher) Size() int

Size returns the number of bytes Sum will return.

func (*Hasher) Sum

func (h *Hasher) Sum(b []byte) []byte

Sum appends the current hash to b and returns the resulting slice. It does not change the underlying hash state.

func (*Hasher) Sum128

func (h *Hasher) Sum128() Uint128

Sum128 returns the 128-bit hash of the written data.

func (*Hasher) Sum64

func (h *Hasher) Sum64() uint64

Sum64 returns the 64-bit hash of the written data.

func (*Hasher) Write

func (h *Hasher) Write(buf []byte) (int, error)

Write adds more data to the running hash. It never returns an error.

func (*Hasher) WriteString

func (h *Hasher) WriteString(buf string) (int, error)

WriteString adds more data to the running hash. It never returns an error.

type Uint128

Uint128 is a 128 bit value. The actual value can be thought of as u.Hi<<64 | u.Lo.

type Uint128 struct {
    Hi, Lo uint64
}

func Hash128

func Hash128(b []byte) Uint128

Hash128 returns the 128-bit hash of the byte slice.

func Hash128Seed

func Hash128Seed(b []byte, seed uint64) Uint128

Hash128Seed returns the 128-bit hash of the byte slice.

func HashString128

func HashString128(s string) Uint128

HashString128 returns the 128-bit hash of the string slice.

func HashString128Seed

func HashString128Seed(s string, seed uint64) Uint128

HashString128Seed returns the 128-bit hash of the string slice.

func (Uint128) Bytes

func (u Uint128) Bytes() [16]byte

Bytes returns the uint128 as an array of bytes in canonical form (big-endian encoded).

Subdirectories

Name Synopsis
..