Expand description
wiki | Various hash functions for cards
The common FNV hashes are often used for implementing hash tables and doing quick checksumming for tests. They are not collision-free, but are fast and simple.
Positional hashes treat cards (or ranks) as digits of a base-n number, They are therefore order-dependent and limited in size, but inherently collision-free and useful for ranking hands.
Bitfield hashes represent each card as a bit in a 64-bit integer. This is inherently order-independent and collision-free, and very fast, but can’t handle duplicate cards and produces huge numbers.
Prime hashes based on the product of prime numbers are inherently collision-free, order-independent, handle duplicates, and produce smaller numbers, but can only handle very small sets.
The “mp” functions create minimal perfect hashes for particular games and are very specific to number of cards and type of deck.
Constants§
- Original SplitMix64 constant
Functions§
- wiki | 32-bit positional hash
- wiki | MPH for ace-to-five low
- wiki | 32-bit positional rank hash
- wiki | 64-bit positional rank hash
- wiki | 32-bit positional hash
- wiki | 64-bit positional hash
- wiki | 64-bit bitfield hash
- wiki | Convert bitfield to MPH Given a bitfield with exactly 4 bits set, return the lexicographic index of that particular set of bits for minimal perfect hash. High-ace deck version, 4 cards (for Badugi).
- wiki | Convert bitfield to MPH Given a bitfield with exactly 4 bits set, return the lexicographic index of that particular set of bits for minimal perfect hash. Low-ace deck version, 4 cards (for Badugi).
- wiki | Convert bitfield to MPH
- wiki | Convert bitfield to MPH Given a bitfield with exactly 5 bits set, return the lexicographic index of that particular set of bits for minimal perfect hash. Low-ace deck version, 5 cards.
- wiki | Convert bitfield to MPH Given a bitfield with exactly 5 bits set, return the lexicographic index of that particular set of bits for minimal perfect hash. Requires Stripped deck, 5 cards.
- wiki | Convert bitfield to MPH
- wiki | Convert bitfield to MPH
- wiki | 32-bit FNV-1a hash
- wiki | 64-bit FNV-1a hash
- wiki | 64-to-32-bit mixer
- wiki | 32-bit prime rank hash
- wiki | 64-bit prime hash
- wiki | 64-bit prime rank hash
- wiki | 32-bit universal hash
- wiki | 64-bit universal hash