maphash

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

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

Go to latest
Published: Oct 13, 2024 License: Apache-2.0 Imports: 3 Imported by: 2

README

maphash

Hash any comparable type using Golang's fast runtime hash. Uses AES instructions when available.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Hasher

type Hasher[K comparable] struct {
	// contains filtered or unexported fields
}

Hasher hashes values of type K. Uses runtime AES-based hashing.

func NewHasher

func NewHasher[K comparable]() Hasher[K]

NewHasher creates a new Hasher[K] with a random seed.

func NewSeed

func NewSeed[K comparable](h Hasher[K]) Hasher[K]

NewSeed returns a copy of |h| with a new hash seed.

func (Hasher[K]) Hash

func (h Hasher[K]) Hash(key K) uint64

Hash hashes |key|.

func (Hasher[K]) Hash2

func (h Hasher[K]) Hash2(key K) uintptr

Hash2 hashes |key| as more flexible uintptr.

type Hasher2

type Hasher2[K any] struct {
	// contains filtered or unexported fields
}

Hasher2 hashes values of type K. Uses runtime AES-based hashing.

func NewHasher2

func NewHasher2[K any]() Hasher2[K]

NewHasher2 creates a new Hasher2[K] with a random seed.

func NewSeed2

func NewSeed2[K comparable](h Hasher2[K]) Hasher2[K]

NewSeed2 returns a copy of |h| with a new hash seed.

func (Hasher2[K]) Hash

func (h Hasher2[K]) Hash(key K) uint64

Hash hashes |key|.

func (Hasher2[K]) Hash2

func (h Hasher2[K]) Hash2(key K) uintptr

Hash2 hashes |key| as more flexible uintptr.

Jump to

Keyboard shortcuts

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