hash

package
v1.11.0 Latest Latest
Warning

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

Go to latest
Published: Mar 8, 2026 License: Apache-2.0, Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetSeeds

func GetSeeds() (a []byte, h []uintptr)

GetSeeds returns the internal seeds used for computing hashes.

func SetSeeds

func SetSeeds(a []byte, h []uintptr) error

SetSeeds sets the internal seeds used for computing hashes.

Types

type H128

type H128 struct{ Lo, Hi uintptr }

H128 holds a 128-bit hash computed in a single pass on AES-capable hardware.

func AnyH128

func AnyH128(i any) H128

AnyH128 returns an H128 hash for i, dispatching to the appropriate H128 function by type. For types implementing Hashable, falls back to two seeded calls.

func BoolH128

func BoolH128(b bool) H128

BoolH128 returns an H128 hash for b.

func Float32H128

func Float32H128(f float32) H128

Float32H128 returns an H128 hash for f (handles NaN and ±0).

func Float64H128

func Float64H128(f float64) H128

Float64H128 returns an H128 hash for f (handles NaN and ±0).

func Int64H128

func Int64H128(x int64) H128

Int64H128 returns an H128 hash for x.

func IntH128

func IntH128(x int) H128

IntH128 returns an H128 hash for x.

func StringH128

func StringH128(s string) H128

StringH128 returns an H128 hash for s.

func Uint8H128

func Uint8H128(x uint8) H128

Uint8H128 returns an H128 hash for x.

func Uint16H128

func Uint16H128(x uint16) H128

Uint16H128 returns an H128 hash for x.

func Uint32H128

func Uint32H128(x uint32) H128

Uint32H128 returns an H128 hash for x.

func Uint64H128

func Uint64H128(x uint64) H128

Uint64H128 returns an H128 hash for x.

func UintH128

func UintH128(x uint) H128

UintH128 returns an H128 hash for x.

func UintptrH128

func UintptrH128(x uintptr) H128

UintptrH128 returns an H128 hash for x.

func (H128) String

func (h H128) String() string

type Hashable

type Hashable interface {
	Hash(seed Seed) Seed
}

Hashable represents a type that can evaluate its own hash.

type Seed

type Seed = uintptr

func Any

func Any(i any, seed Seed) Seed

Any returns a hash for i.

func Bool

func Bool(b bool, seed Seed) Seed

Bool returns a hash for b.

func Complex64

func Complex64(c complex64, seed Seed) Seed

Complex64 returns a hash for c.

func Complex128

func Complex128(c complex128, seed Seed) Seed

Complex128 returns a hash for c.

func Float32

func Float32(f float32, seed Seed) Seed

Float32 returns a hash for f.

func Float64

func Float64(f float64, seed Seed) Seed

Float64 returns a hash for f.

func Int

func Int(x int, seed Seed) Seed

Int returns a hash for x.

func Int8

func Int8(x int8, seed Seed) Seed

Int8 returns a hash for x.

func Int16

func Int16(x int16, seed Seed) Seed

Int16 returns a hash for x.

func Int32

func Int32(x int32, seed Seed) Seed

Int32 returns a hash for x.

func Int64

func Int64(x int64, seed Seed) Seed

Int64 returns a hash for x.

func Interface deprecated

func Interface(a any, seed Seed) Seed

Interface returns a hash for i.

Deprecated: Use Any instead.

func String

func String(s string, seed Seed) Seed

String returns a hash for s.

func Uint

func Uint(x uint, seed Seed) Seed

Uint returns a hash for x.

func Uint8

func Uint8(x uint8, seed Seed) Seed

Uint8 returns a hash for x.

func Uint16

func Uint16(x uint16, seed Seed) Seed

Uint16 returns a hash for x.

func Uint32

func Uint32(x uint32, seed Seed) Seed

Uint32 returns a hash for x.

func Uint64

func Uint64(x uint64, seed Seed) Seed

Uint64 returns a hash for x.

func Uintptr

func Uintptr(x, seed Seed) Seed

Uintptr returns a hash for x.

func UnsafePointer

func UnsafePointer(p unsafe.Pointer, seed Seed) Seed

UnsafePointer returns a hash for p.

func Value

func Value(v reflect.Value, seed Seed) Seed

Value returns a hash for v.

Jump to

Keyboard shortcuts

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