org.getopt.util.hash
Class FNV1a32
java.lang.Object
org.getopt.util.hash.FNV1
org.getopt.util.hash.FNV1a32
public class FNV1a32
- extends FNV1
Implementation of FNV1a - a fast hash function. The FNV1a variant provides a
slightly better dispersion for short (< 4 bytes) values than plain FNV1.
This implementation uses 32-bit operations, and the values returned from
getHash() are limited to the lower 32 bits.
- Author:
- Andrzej Bialecki <ab@getopt.org>
|
Constructor Summary |
FNV1a32()
Create a hash |
|
Method Summary |
protected long |
fnv(byte[] buf,
int offset,
int len,
long seed)
Compute the hash value. |
long |
getHash()
Retrieve the hash value |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
FNV1a32
public FNV1a32()
- Create a hash
getHash
public long getHash()
- Description copied from class:
FNV1
- Retrieve the hash value
- Overrides:
getHash in class FNV1
- Returns:
- hash value
fnv
protected long fnv(byte[] buf,
int offset,
int len,
long seed)
- Description copied from class:
FNV1
- Compute the hash value.
- Specified by:
fnv in class FNV1
- Parameters:
buf - byte buffer from which to compute the hashoffset - starting position in the bufferlen - number of bytes after the starting positionseed - initial seed (or previous hash value)
- Returns:
- the next hash value