Documentation ¶
Index ¶
- func ByteSliceToBigInt(p []byte) int
- func ByteSliceToFNV(p []byte) []byte
- func ByteSliceToIntKey(p []byte) int
- func ByteSliceToString(p []byte) string
- func ByteSliceToStringZeroAlloc(p []byte) string
- func Djb2(s string) int64
- func FxHasher(word uint64) uint64
- func StringToIndex16(s string) (index int)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ByteSliceToBigInt ¶
func ByteSliceToFNV ¶
func ByteSliceToIntKey ¶
func ByteSliceToString ¶
func Djb2 ¶
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 ¶
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 ¶
StringToIndex taken from a custom map implementation.
Types ¶
This section is empty.