java.lang.Object
net.i2p.util.SipHash
Wrapper around SipHashInline with constant per-JVM keys.
Field Summary
Constructor Summary
ConstructorsConstructorDescriptionSipHash()Constructor for subclasses that hash with their own key rather than the per-JVM key.Method Summary
All Methods
Field Details
K0
private static final long K0First key word, random per JVM so the hash is not predictableK1
private static final long K1Second key word, random per JVM
Constructor Details
SipHash
public SipHash()Constructor for subclasses that hash with their own key rather than the per-JVM key.
Method Details
digest
public static long digest(byte[] data) Hash a whole array.- Parameters:
data- non-null- Returns:
- the 64-bit SipHash-2-4 digest of the array under this JVM's random keys
digest
public static long digest(byte[] data, int off, int len) Hash a region of an array.- Parameters:
data- non-nulloff- the index in data at which the hashed region beginslen- the number of bytes to hash, counting from off- Returns:
- the 64-bit SipHash-2-4 digest of that region under this JVM's random keys
hashCode
public static int hashCode(byte[] data) Secure replacement forDataHelper.hashCode(byte[]); caching recommended.- Parameters:
data- may be null- Returns:
- whether h code is present