@PublicationReference(author="Wikipedia",title="Fowler\u2013Noll\u2013Vo hash function",type=WebPage,year=2011,url="http://en.wikipedia.org/wiki/Fowler%E2%80%93Noll%E2%80%93Vo_hash_function") @PublicationReference(author="Landon Curt Noll",title="FNV-1a",type=WebPage,year=2011,url="http://isthe.com/chongo/tech/comp/fnv/#FNV-1a") public class FNV1a64Hash extends AbstractHashFunction
Modifier and Type | Field and Description |
---|---|
static long |
DEFAULT_PRIME
Default FNV-1 prime, 1099511628211L.
|
protected static byte[] |
DEFAULT_SEED
Byte representation of DEFAULT_SEED_INT
|
static long |
DEFAULT_SEED_LONG
Default FNV-1 seed, -3750763034362895579L == (signed) 14695981039346656037
|
static int |
LENGTH
Length of the hash is 64-bits (8-bytes), 8.
|
Constructor and Description |
---|
FNV1a64Hash()
Creates a new instance of FNV1a32Hash
|
Modifier and Type | Method and Description |
---|---|
FNV1a64Hash |
clone()
This makes public the clone method on the
Object class and
removes the exception that it throws. |
void |
evaluateInto(byte[] input,
byte[] output,
byte[] seed)
Evaluates the input into the given output
|
byte[] |
getDefaultSeed()
Gets the default seed for the hash function
|
static long |
hash(byte[] input)
FNV-1a 64-bit hash function
|
static long |
hash(byte[] input,
long seed)
FNV-1a 64-bit hash function
|
int |
length()
Returns the number of bytes in the output hash code.
|
evaluate, evaluate, evaluateInto
public static final int LENGTH
public static final long DEFAULT_SEED_LONG
protected static final byte[] DEFAULT_SEED
public static final long DEFAULT_PRIME
public FNV1a64Hash clone()
AbstractCloneableSerializable
Object
class and
removes the exception that it throws. Its default behavior is to
automatically create a clone of the exact type of object that the
clone is called on and to copy all primitives but to keep all references,
which means it is a shallow copy.
Extensions of this class may want to override this method (but call
super.clone()
to implement a "smart copy". That is, to target
the most common use case for creating a copy of the object. Because of
the default behavior being a shallow copy, extending classes only need
to handle fields that need to have a deeper copy (or those that need to
be reset). Some of the methods in ObjectUtil
may be helpful in
implementing a custom clone method.
Note: The contract of this method is that you must use
super.clone()
as the basis for your implementation.clone
in interface CloneableSerializable
clone
in class AbstractHashFunction
public int length()
HashFunction
public byte[] getDefaultSeed()
HashFunction
public static long hash(byte[] input)
input
- Input to hashpublic static long hash(byte[] input, long seed)
input
- Input to hashseed
- Seed to use as the offsetpublic void evaluateInto(byte[] input, byte[] output, byte[] seed)
HashFunction
input
- Input to compute the hash-function value ofoutput
- Output to put the hash-function intoseed
- Seed to offset the hash code.