|
BashSpark
|
Custom hash functor for strings using the 64-bit FNV-1a algorithm. More...
#include <shell_hash.h>
Public Member Functions | |
| std::uint64_t | operator() (const std::string &sString) const noexcept |
| Computes a 64-bit FNV-1a hash for a string. | |
Static Public Attributes | |
| static constexpr std::uint64_t | FNV_OFFSET = 1469598103934665603ull |
| FVN offset. | |
| static constexpr std::uint64_t | FNV_PRIME = 1099511628211ull |
| FVN prime. | |
Custom hash functor for strings using the 64-bit FNV-1a algorithm.
This hash function is fast, has good distribution, and works well for small and medium-sized strings such as shell tokens, variable names, and keywords.
|
inlinenoexcept |
Computes a 64-bit FNV-1a hash for a string.
| sString | The input string to hash. |
This implementation is based on the standard 64-bit FNV-1a algorithm:
The algorithm is simple but effective for non-cryptographic use.