HashUtil

HashUtil

new HashUtil()

Source:
Author:
  • ycx
hash工具类

Methods

(static) fnvHash(data) → {number}

Source:
FNV算法 hash
Parameters:
Name Type Description
data string
Returns:
Type
number

(static) hornerHash(str, size)

Source:
霍纳法则是求多项式值的一个快速算法: a0*x0+a1*x1+a2*x2+a3*x3+……an*x^n //n* (n+1)/2 次乘法 =(((……(((an+an-1)*x+an-2)*x+an-3)*x)+……)*x+a1)*x+a0 //复杂度 为 O(n)
Parameters:
Name Type Description
str String 指定字符串
size Number hash表长度
Returns:
number

(static) murmurHas(data, offset, seed) → {number}

Source:
MurmurHash
是一种非加密型哈希函数,适用于一般的哈希检索操作
Parameters:
Name Type Description
data
offset
seed
Returns:
Type
number