maphash

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

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

Go to latest
Published: May 8, 2025 License: Apache-2.0 Imports: 2 Imported by: 1

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](seed Seed) Hasher[K]

NewHasher creates a new Hasher[K] with a random 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.

func (Hasher[K]) WithSeed

func (h Hasher[K]) WithSeed(seed Seed) Hasher[K]

WithSeed returns copy of hasher with another seed

type Seed

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

func NewSeed

func NewSeed(s uintptr) Seed

NewSeed returns new seed from uintptr value

func RandomSeed

func RandomSeed() Seed

RandomSeed returns new random seed

Jump to

Keyboard shortcuts

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