This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* A simple hashing function based on FNV-1a (Fowler-Noll-Vo) algorithm | |
* @param str the string to hash | |
* @returns the hash of the string | |
* @see https://en.wikipedia.org/wiki/Fowler%E2%80%93Noll%E2%80%93Vo_hash_function | |
* Outputs a 128-bit hash (32 characters long) | |
*/ | |
const hash = (str) => { | |
const FNV_PRIME = 0x01000193; | |
const h = [0x811c9dc5, 0x056892cd, 0x6b6b2d4f, 0x458e7388]; |