Package com.google.common.hash
Class SipHashFunction.SipHasher
- java.lang.Object
-
- com.google.common.hash.AbstractHasher
-
- com.google.common.hash.AbstractStreamingHasher
-
- com.google.common.hash.SipHashFunction.SipHasher
-
- All Implemented Interfaces:
Hasher
,PrimitiveSink
- Enclosing class:
- SipHashFunction
private static final class SipHashFunction.SipHasher extends AbstractStreamingHasher
-
-
Constructor Summary
Constructors Constructor Description SipHasher(int c, int d, long k0, long k1)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description HashCode
makeHash()
Computes a hash code based on the data that have been provided to this hasher.protected void
process(java.nio.ByteBuffer buffer)
Processes the available bytes of the buffer (at mostchunk
bytes).private void
processM(long m)
protected void
processRemaining(java.nio.ByteBuffer buffer)
This is invoked for the last bytes of the input, which are not enough to fill a whole chunk.private void
sipRound(int iterations)
-
Methods inherited from class com.google.common.hash.AbstractStreamingHasher
hash, putByte, putBytes, putBytes, putChar, putInt, putLong, putShort
-
Methods inherited from class com.google.common.hash.AbstractHasher
putBoolean, putBytes, putDouble, putFloat, putObject, putString, putUnencodedChars
-
-
-
-
Field Detail
-
CHUNK_SIZE
private static final int CHUNK_SIZE
- See Also:
- Constant Field Values
-
c
private final int c
-
d
private final int d
-
v0
private long v0
-
v1
private long v1
-
v2
private long v2
-
v3
private long v3
-
b
private long b
-
finalM
private long finalM
-
-
Method Detail
-
process
protected void process(java.nio.ByteBuffer buffer)
Description copied from class:AbstractStreamingHasher
Processes the available bytes of the buffer (at mostchunk
bytes).- Specified by:
process
in classAbstractStreamingHasher
-
processRemaining
protected void processRemaining(java.nio.ByteBuffer buffer)
Description copied from class:AbstractStreamingHasher
This is invoked for the last bytes of the input, which are not enough to fill a whole chunk. The passedByteBuffer
is guaranteed to be non-empty.This implementation simply pads with zeros and delegates to
AbstractStreamingHasher.process(ByteBuffer)
.- Overrides:
processRemaining
in classAbstractStreamingHasher
-
makeHash
public HashCode makeHash()
Description copied from class:AbstractStreamingHasher
Computes a hash code based on the data that have been provided to this hasher. This is called after all chunks are handled withAbstractStreamingHasher.process(java.nio.ByteBuffer)
and any leftover bytes that did not make a complete chunk are handled withAbstractStreamingHasher.processRemaining(java.nio.ByteBuffer)
.- Specified by:
makeHash
in classAbstractStreamingHasher
-
processM
private void processM(long m)
-
sipRound
private void sipRound(int iterations)
-
-