| 限定符和类型 | 字段和说明 |
|---|---|
protected long |
seed |
| 构造器和说明 |
|---|
AbstractHasher() |
| 限定符和类型 | 方法和说明 |
|---|---|
protected int |
asInt(byte[] bytes) |
protected long |
asLong(byte[] bytes) |
protected AbstractHasher |
createInstance(Object initParams) |
Hasher |
get(Object initParams) |
String |
getName() |
long |
hash(byte[] bytes)
计算hash
|
abstract long |
hash(byte[] bytes,
int length,
long seed)
一次性计算 hash
Calculate a hash using bytes from 0 to
length, and
the provided seed value |
long |
hash(byte[] bytes,
long seed)
一次性计算 hash
Calculate a hash using all bytes from the input argument,
and a provided seed value.
|
protected long |
padToLong(byte[] bytes) |
void |
setSeed(long seed) |
protected long |
toLong(byte[] bytes)
当 hash 计算后,结果如果是 byte[] 时,需要使用下面的几个方法进行转换
|
public void setSeed(long seed)
seed - 也是初始值public long hash(byte[] bytes,
long seed)
HasherCalculate a hash using all bytes from the input argument, and a provided seed value.
public abstract long hash(byte[] bytes,
int length,
long seed)
Calculate a hash using bytes from 0 to length, and
the provided seed value
public String getName()
protected AbstractHasher createInstance(Object initParams)
protected long toLong(byte[] bytes)
protected int asInt(byte[] bytes)
protected long asLong(byte[] bytes)
protected long padToLong(byte[] bytes)
Copyright © 2022. All rights reserved.