| 
 | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.google.common.hash.Hashing
@Beta public final class Hashing
Static methods to obtain HashFunction instances, and other static
 hashing-related utilities.
| Method Summary | |
|---|---|
| static HashCode | combineOrdered(Iterable<HashCode> hashCodes)Returns a hash code, having the same bit length as each of the input hash codes, that combines the information of these hash codes in an ordered fashion. | 
| static HashCode | combineUnordered(Iterable<HashCode> hashCodes)Returns a hash code, having the same bit length as each of the input hash codes, that combines the information of these hash codes in an unordered fashion. | 
| static int | consistentHash(HashCode hashCode,
                             int buckets)Assigns to hashCodea "bucket" in the range[0, buckets), in a uniform
 manner that minimizes the need for remapping asbucketsgrows. | 
| static int | consistentHash(long input,
                             int buckets)Assigns to inputa "bucket" in the range[0, buckets), in a uniform
 manner that minimizes the need for remapping asbucketsgrows. | 
| static HashFunction | goodFastHash(int minimumBits)Returns a general-purpose, non-cryptographic-strength, streaming hash function that produces hash codes of length at least minimumBits. | 
| static HashFunction | md5()Returns a hash function implementing the MD5 hash algorithm (128 hash bits) by delegating to the MD5 MessageDigest. | 
| static HashFunction | murmur3_128()Returns a hash function implementing the 128-bit murmur3 algorithm, x64 variant (little-endian variant), using a seed value of zero. | 
| static HashFunction | murmur3_128(int seed)Returns a hash function implementing the 128-bit murmur3 algorithm, x64 variant (little-endian variant), using the given seed value. | 
| static HashFunction | murmur3_32()Returns a hash function implementing the 32-bit murmur3 algorithm (little-endian variant), using a seed value of zero. | 
| static HashFunction | murmur3_32(int seed)Returns a hash function implementing the 32-bit murmur3 algorithm (little-endian variant), using the given seed value. | 
| static long | padToLong(HashCode hashCode)If hashCodehas enough bits, returnshashCode.asLong(), otherwise
 returns alongvalue withhashCode.asInt()as the least-significant
 four bytes and0x00as each of the most-significant four bytes. | 
| static HashFunction | sha1()Returns a hash function implementing the SHA-1 algorithm (160 hash bits) by delegating to the SHA-1 MessageDigest. | 
| static HashFunction | sha256()Returns a hash function implementing the SHA-256 algorithm (256 hash bits) by delegating to the SHA-256 MessageDigest. | 
| static HashFunction | sha512()Returns a hash function implementing the SHA-512 algorithm (512 hash bits) by delegating to the SHA-512 MessageDigest. | 
| Methods inherited from class java.lang.Object | 
|---|
| clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait | 
| Method Detail | 
|---|
public static HashFunction goodFastHash(int minimumBits)
minimumBits. Users without specific
 compatibility requirements and who do not persist the hash codes are encouraged to
 choose this hash function.
 Warning: the implementation is unspecified and is subject to change.
IllegalArgumentException - if minimumBits is not positivepublic static HashFunction murmur3_32(int seed)
public static HashFunction murmur3_32()
public static HashFunction murmur3_128(int seed)
public static HashFunction murmur3_128()
public static HashFunction md5()
MessageDigest.
public static HashFunction sha1()
MessageDigest.
public static HashFunction sha256()
MessageDigest.
public static HashFunction sha512()
MessageDigest.
public static long padToLong(HashCode hashCode)
hashCode has enough bits, returns hashCode.asLong(), otherwise
 returns a long value with hashCode.asInt() as the least-significant
 four bytes and 0x00 as each of the most-significant four bytes.
public static int consistentHash(HashCode hashCode,
                                 int buckets)
hashCode a "bucket" in the range [0, buckets), in a uniform
 manner that minimizes the need for remapping as buckets grows. That is,
 consistentHash(h, n) equals:
 n - 1, with approximate probability 1/n
 consistentHash(h, n - 1), otherwise (probability 1 - 1/n)
 See the wikipedia article on consistent hashing for more information.
public static int consistentHash(long input,
                                 int buckets)
input a "bucket" in the range [0, buckets), in a uniform
 manner that minimizes the need for remapping as buckets grows. That is,
 consistentHash(h, n) equals:
 n - 1, with approximate probability 1/n
 consistentHash(h, n - 1), otherwise (probability 1 - 1/n)
 See the wikipedia article on consistent hashing for more information.
public static HashCode combineOrdered(Iterable<HashCode> hashCodes)
IllegalArgumentException - if hashCodes is empty, or the hash codes
     do not all have the same bit lengthpublic static HashCode combineUnordered(Iterable<HashCode> hashCodes)
IllegalArgumentException - if hashCodes is empty, or the hash codes
     do not all have the same bit length| 
 | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||