public class HashUtil extends Object
Constructor and Description |
---|
HashUtil() |
Modifier and Type | Method and Description |
---|---|
static int |
additiveHash(String key,
int prime)
加法hash
|
static int |
apHash(String str)
AP算法
|
static int |
bernstein(String key)
Bernstein's hash
|
static int |
bkdrHash(String str)
BKDR算法
|
static long[] |
cityHash128(byte[] data)
CityHash算法128-bit实现
|
static long[] |
cityHash128(byte[] data,
Number128 seed)
CityHash算法128-bit实现
|
static int |
cityHash32(byte[] data)
CityHash算法32-bit实现
|
static long |
cityHash64(byte[] data)
CityHash算法64-bit实现
|
static long |
cityHash64(byte[] data,
long seed)
CityHash算法64-bit实现,种子1使用默认的CityHash#k2
|
static long |
cityHash64(byte[] data,
long seed0,
long seed1)
CityHash算法64-bit实现,种子1使用默认的CityHash#k2
|
static int |
dekHash(String str)
DEK算法
|
static int |
djbHash(String str)
DJB算法
|
static int |
elfHash(String str)
ELF算法
|
static int |
fnvHash(byte[] data)
改进的32位FNV算法1
|
static int |
fnvHash(String data)
改进的32位FNV算法1
|
static long |
hfHash(String data)
HF Hash算法
|
static long |
hfIpHash(String data)
HFIP Hash算法
|
static int |
identityHashCode(Object obj)
根据对象的内存地址生成相应的Hash值
|
static int |
intHash(int key)
Thomas Wang的算法,整数hash
|
static int |
javaDefaultHash(String str)
JAVA自己带的算法
|
static int |
jsHash(String str)
JS算法
|
static long[] |
metroHash128(byte[] data)
MetroHash 算法128-bit实现
|
static long[] |
metroHash128(byte[] data,
long seed)
MetroHash 算法128-bit实现
|
static long |
metroHash64(byte[] data)
MetroHash 算法64-bit实现
|
static long |
metroHash64(byte[] data,
long seed)
MetroHash 算法64-bit实现
|
static long |
mixHash(String str)
混合hash算法,输出64位的值
|
static long[] |
murmur128(byte[] data)
MurmurHash算法128-bit实现
|
static int |
murmur32(byte[] data)
MurmurHash算法32-bit实现
|
static long |
murmur64(byte[] data)
MurmurHash算法64-bit实现
|
static int |
oneByOneHash(String key)
一次一个hash
|
static int |
pjwHash(String str)
PJW算法
|
static int |
rotatingHash(String key,
int prime)
旋转hash
|
static int |
rsHash(String str)
RS算法hash
|
static int |
sdbmHash(String str)
SDBM算法
|
static long |
tianlHash(String str)
TianL Hash算法
|
static int |
universal(char[] key,
int mask,
int[] tab)
Universal Hashing
|
static int |
zobrist(char[] key,
int mask,
int[][] tab)
Zobrist Hashing
|
public static int additiveHash(String key, int prime)
key
- 字符串prime
- 一个质数public static int rotatingHash(String key, int prime)
key
- 输入字符串prime
- 质数public static int oneByOneHash(String key)
key
- 输入字符串public static int bernstein(String key)
key
- 输入字节数组public static int universal(char[] key, int mask, int[] tab)
key
- 字节数组mask
- 掩码tab
- tabpublic static int zobrist(char[] key, int mask, int[][] tab)
key
- 字节数组mask
- 掩码tab
- tabpublic static int fnvHash(byte[] data)
data
- 数组public static int fnvHash(String data)
data
- 字符串public static int intHash(int key)
key
- 整数public static int rsHash(String str)
str
- 字符串public static int jsHash(String str)
str
- 字符串public static int pjwHash(String str)
str
- 字符串public static int elfHash(String str)
str
- 字符串public static int bkdrHash(String str)
str
- 字符串public static int sdbmHash(String str)
str
- 字符串public static int djbHash(String str)
str
- 字符串public static int dekHash(String str)
str
- 字符串public static int apHash(String str)
str
- 字符串public static long tianlHash(String str)
str
- 字符串public static int javaDefaultHash(String str)
str
- 字符串public static long mixHash(String str)
str
- 字符串public static int identityHashCode(Object obj)
obj
- 对象public static int murmur32(byte[] data)
data
- 数据public static long murmur64(byte[] data)
data
- 数据public static long[] murmur128(byte[] data)
data
- 数据public static int cityHash32(byte[] data)
data
- 数据public static long cityHash64(byte[] data, long seed)
data
- 数据seed
- 种子2public static long cityHash64(byte[] data, long seed0, long seed1)
data
- 数据seed0
- 种子1seed1
- 种子2public static long cityHash64(byte[] data)
data
- 数据public static long[] cityHash128(byte[] data)
data
- 数据public static long[] cityHash128(byte[] data, Number128 seed)
data
- 数据seed
- 种子public static long metroHash64(byte[] data, long seed)
data
- 数据seed
- 种子public static long metroHash64(byte[] data)
data
- 数据public static long[] metroHash128(byte[] data, long seed)
data
- 数据seed
- 种子public static long[] metroHash128(byte[] data)
data
- 数据public static long hfHash(String data)
data
- 字符串public static long hfIpHash(String data)
data
- 字符串Copyright © 2024. All rights reserved.