mapkey

package
v0.0.0-...-5b377e2 Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ByteSliceToBigInt

func ByteSliceToBigInt(p []byte) int

func ByteSliceToFNV

func ByteSliceToFNV(p []byte) []byte

func ByteSliceToIntKey

func ByteSliceToIntKey(p []byte) int

func ByteSliceToString

func ByteSliceToString(p []byte) string

func ByteSliceToStringZeroAlloc

func ByteSliceToStringZeroAlloc(p []byte) string

func Djb2

func Djb2(s string) int64

https://theartincode.stanis.me/008-djb2/ Written by Daniel J. Bernstein (also known as djb), this simple hash function dates back to 1991.

func FxHasher

func FxHasher(word uint64) uint64

FxHasher is based on a hash function used within Firefox. (Indeed, the Fx is short for “Firefox”.)

(Are you wondering where the constant 0x517cc1b727220a95 comes from? 0xffff_ffff_ffff_ffff / 0x517c_c1b7_2722_0a95 = π.)

In terms of hashing quality, it is mediocre. If you run it through a hash quality tester it will fail a number of the tests. For example, if you hash any sequence of N zeroes, you get zero. And yet, for use in hash tables within the Rust compiler, it’s hard to beat.

func StringToIndex16

func StringToIndex16(s string) (index int)

StringToIndex taken from a custom map implementation.

Types

This section is empty.

Jump to

Keyboard shortcuts

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