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
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected HashCode
makeHash()
Computes a hash code based on the data that have been provided to this hasher.protected void
process
(ByteBuffer buffer) Processes the available bytes of the buffer (at mostchunk
bytes).private void
processM
(long m) protected void
processRemaining
(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 Details
-
CHUNK_SIZE
private static final int CHUNK_SIZE- See Also:
-
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
-
-
Constructor Details
-
SipHasher
SipHasher(int c, int d, long k0, long k1)
-
-
Method Details
-
process
Description copied from class:AbstractStreamingHasher
Processes the available bytes of the buffer (at mostchunk
bytes).- Specified by:
process
in classAbstractStreamingHasher
-
processRemaining
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
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)
-