hash

package
v2.0.0 Latest Latest
Warning

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

Go to latest
Published: Sep 12, 2026 License: Apache-2.0, Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Any

func Any(i any) uintptr

Any returns a hash for i.

func Bool

func Bool(b bool) uintptr

Bool returns a hash for b.

func Bytes

func Bytes(b []byte) uintptr

Bytes returns a hash for b. Same split as String, with a distinct salt so []byte("ab") does not hash like "ab".

func Combine

func Combine(h, o uintptr) uintptr

Combine folds o into h asymmetrically. Use it to hash ordered or keyed structures: Combine(a, b) != Combine(b, a) in general, and Combine(Combine(s, a), b) differs from Combine(Combine(s, b), a). Unordered collections should XOR their element hashes instead and pass the result through a scalar hash once at the end.

func Complex64

func Complex64(c complex64) uintptr

Complex64 returns a hash for c.

func Complex128

func Complex128(c complex128) uintptr

Complex128 returns a hash for c.

func Float32

func Float32(f float32) uintptr

Float32 returns a hash for f. +0 and -0 hash alike; every NaN hashes differently, so that NaN != NaN holds for hashing as it does for comparison.

func Float64

func Float64(f float64) uintptr

Float64 returns a hash for f. +0 and -0 hash alike; every NaN hashes differently, so that NaN != NaN holds for hashing as it does for comparison.

func GetSeeds

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

GetSeeds returns the internal seeds used for computing hashes.

func Int

func Int(x int) uintptr

Int returns a hash for x.

func Int8

func Int8(x int8) uintptr

Int8 returns a hash for x.

func Int16

func Int16(x int16) uintptr

Int16 returns a hash for x.

func Int32

func Int32(x int32) uintptr

Int32 returns a hash for x.

func Int64

func Int64(x int64) uintptr

Int64 returns a hash for x.

func SetSeeds

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

SetSeeds sets the internal seeds used for computing hashes.

func String

func String(s string) uintptr

String returns a hash for s. Sequences of at most 16 bytes go through the inlined mixer; longer strings use the AES memhash path.

func Uint

func Uint(x uint) uintptr

Uint returns a hash for x.

func Uint8

func Uint8(x uint8) uintptr

Uint8 returns a hash for x.

func Uint16

func Uint16(x uint16) uintptr

Uint16 returns a hash for x.

func Uint32

func Uint32(x uint32) uintptr

Uint32 returns a hash for x.

func Uint64

func Uint64(x uint64) uintptr

Uint64 returns a hash for x.

func Uintptr

func Uintptr(x uintptr) uintptr

Uintptr returns a hash for x.

func UnsafePointer

func UnsafePointer(p unsafe.Pointer) uintptr

UnsafePointer returns a hash for p.

func Value

func Value(v reflect.Value) uintptr

Value returns a hash for v. Defined types hash like their underlying kind; Equal distinguishes int(5) from ID(5) when they share a slot.

Types

type Hashable

type Hashable interface {
	Hash() uintptr
}

Hashable represents a type that can evaluate its own hash.

type Seed

type Seed = uintptr

Jump to

Keyboard shortcuts

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