Top Description Inners Fields Constructors Methods
com.google.common.hash

pack-priv final Class Crc32cHashFunction

extends AbstractHashFunction
Class Inheritance
Annotations
@Immutable
@ElementTypesAreNonnullByDefault
Imports
com.google.errorprone.annotations.Immutable, java.nio.ByteBuffer

This class generates a CRC32C checksum, defined by RFC 3720, Section 12.1. The generator polynomial for this checksum is 0x11EDC6F41.
Author
Kurt Alfred Kluever

Nested and Inner Type Summary

Modifier and TypeClass and Description
pack-priv static class

Field Summary

Modifier and TypeField and Description
pack-priv static final HashFunction

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
public int
bits()

Implements com.google.common.hash.HashFunction.bits.

Returns the number of bits (a multiple of 32) that each hash code produced by this hash function has.
public Hasher
newHasher()

Implements com.google.common.hash.HashFunction.newHasher.

Begins a new hash code computation by returning an initialized, stateful Hasher instance that is ready to receive data.
public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.
Inherited from com.google.common.hash.AbstractHashFunction:
hashByteshashByteshashByteshashInthashLonghashObjecthashStringhashUnencodedCharsnewHasher

Field Detail

CRC_32_Cback to summary
pack-priv static final HashFunction CRC_32_C

Constructor Detail

Crc32cHashFunctionback to summary
pack-priv Crc32cHashFunction()

Method Detail

bitsback to summary
public int bits()

Implements com.google.common.hash.HashFunction.bits.

Doc from com.google.common.hash.HashFunction.bits.

Returns the number of bits (a multiple of 32) that each hash code produced by this hash function has.

Annotations
@Override
newHasherback to summary
public Hasher newHasher()

Implements com.google.common.hash.HashFunction.newHasher.

Doc from com.google.common.hash.HashFunction.newHasher.

Begins a new hash code computation by returning an initialized, stateful Hasher instance that is ready to receive data. Example:

HashFunction hf = Hashing.md5();
HashCode hc = hf.newHasher()
    .putLong(id)
    .putBoolean(isActive)
    .hash();
Annotations
@Override
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object.

Returns:String

a string representation of the object

Annotations
@Override
com.google.common.hash back to summary

pack-priv final Class Crc32cHashFunction.Crc32cHasher

extends AbstractStreamingHasher
Class Inheritance

Field Summary

Modifier and TypeField and Description
pack-priv static final int[]
private int
private int
private int
private int
private static final ByteBuffer
private boolean
pack-priv static final int
pack-priv static final int[][]

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
pack-priv static int
combine(int csum, int crc)

pack-priv static int
computeForWord(int word)

protected HashCode
makeHash()

Implements abstract com.google.common.hash.AbstractStreamingHasher.makeHash.

Computes a hash code based on the data that have been provided to this hasher.
protected void
process(ByteBuffer bb)

Implements abstract com.google.common.hash.AbstractStreamingHasher.process.

Processes the available bytes of the buffer (at most chunk bytes).
protected void
processRemaining(ByteBuffer bb)

Overrides com.google.common.hash.AbstractStreamingHasher.processRemaining.

This is invoked for the last bytes of the input, which are not enough to fill a whole chunk.
Inherited from com.google.common.hash.AbstractStreamingHasher:
hashputByteputBytesputBytesputCharputIntputLongputShort

Field Detail

BYTE_TABLEback to summary
pack-priv static final int[] BYTE_TABLE
crc0back to summary
private int crc0
crc1back to summary
private int crc1
crc2back to summary
private int crc2
crc3back to summary
private int crc3
EMPTYback to summary
private static final ByteBuffer EMPTY
finishedback to summary
private boolean finished
INVERSE_COMPUTE_FOR_WORD_OF_ALL_1Sback to summary
pack-priv static final int INVERSE_COMPUTE_FOR_WORD_OF_ALL_1S
STRIDE_TABLEback to summary
pack-priv static final int[][] STRIDE_TABLE

Constructor Detail

Crc32cHasherback to summary
pack-priv Crc32cHasher()

Method Detail

combineback to summary
pack-priv static int combine(int csum, int crc)
computeForWordback to summary
pack-priv static int computeForWord(int word)
makeHashback to summary
protected HashCode makeHash()

Implements abstract com.google.common.hash.AbstractStreamingHasher.makeHash.

Doc from com.google.common.hash.AbstractStreamingHasher.makeHash.

Computes a hash code based on the data that have been provided to this hasher. This is called after all chunks are handled with process and any leftover bytes that did not make a complete chunk are handled with processRemaining.

Annotations
@Override
processback to summary
protected void process(ByteBuffer bb)

Implements abstract com.google.common.hash.AbstractStreamingHasher.process.

Doc from com.google.common.hash.AbstractStreamingHasher.process.

Processes the available bytes of the buffer (at most chunk bytes).

Annotations
@Override
processRemainingback to summary
protected void processRemaining(ByteBuffer bb)

Overrides com.google.common.hash.AbstractStreamingHasher.processRemaining.

Doc from com.google.common.hash.AbstractStreamingHasher.processRemaining.

This is invoked for the last bytes of the input, which are not enough to fill a whole chunk. The passed ByteBuffer is guaranteed to be non-empty.

This implementation simply pads with zeros and delegates to process(ByteBuffer).

Annotations
@Override