Package com.scurrilous.circe
Class CommonHashes
java.lang.Object
com.scurrilous.circe.CommonHashes
Static methods to obtain commonly-used hash functions. Note that a suitable
provider JAR must be made available on the class path. This class does not
have direct access to specific implementations; it simply constructs the hash
parameters and uses the
Hashes class to search for a provider.-
Method Summary
Modifier and TypeMethodDescriptionstatic IncrementalIntHashcrc32()Returns an incremental stateless hash function implementing the CRC-32 checksum algorithm.static IncrementalIntHashcrc32c()Returns an incremental stateless hash function implementing the CRC-32C checksum algorithm.static IncrementalLongHashcrc64()Returns an incremental stateless hash function implementing the CRC-64 checksum algorithm.static StatefulHashmd5()Returns a hash function implementing the MD5 algorithm (128 bits).static StatefulHashReturns a hash function implementing the MurmurHash3 algorithm, 128-bit x64 variant, with a seed of 0.static StatefulHashmurmur3_128(int seed) Returns a hash function implementing the MurmurHash3 algorithm, 128-bit x64 variant, with the given seed value.static StatelessIntHashReturns a hash function implementing the MurmurHash3 algorithm, 32-bit x86 variant, with a seed of 0.static StatelessIntHashmurmur3_32(int seed) Returns a hash function implementing the MurmurHash3 algorithm, 32-bit x86 variant, with the given seed valuestatic StatefulHashsha1()Returns a hash function implementing the SHA-1 algorithm (160 bits).static StatefulHashsha256()Returns a hash function implementing the SHA-256 algorithm (256 bits).static StatefulHashsha384()Returns a hash function implementing the SHA-384 algorithm (384 bits).static StatefulHashsha512()Returns a hash function implementing the SHA-512 algorithm (512 bits).static StatelessLongHashReturns a hash function implementing the SipHash-2-4 algorithm (64 bits) with the default seed,00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F.static StatelessLongHashsipHash24(long seedLow, long seedHigh) Returns a hash function implementing the SipHash-2-4 algorithm (64 bits) with the given seed value.
-
Method Details
-
crc32
Returns an incremental stateless hash function implementing the CRC-32 checksum algorithm.- Returns:
- a CRC-32 stateless incremental integer hash
- Throws:
UnsupportedOperationException- if no provider is available
-
crc32c
Returns an incremental stateless hash function implementing the CRC-32C checksum algorithm.- Returns:
- a CRC-32C stateless incremental integer hash
- Throws:
UnsupportedOperationException- if no provider is available
-
crc64
Returns an incremental stateless hash function implementing the CRC-64 checksum algorithm.- Returns:
- a CRC-64 stateless incremental long integer hash
- Throws:
UnsupportedOperationException- if no provider is available
-
murmur3_32
Returns a hash function implementing the MurmurHash3 algorithm, 32-bit x86 variant, with a seed of 0.- Returns:
- a MurmurHash3 32-bit/x86 stateless integer hash
- Throws:
UnsupportedOperationException- if no provider is available
-
murmur3_32
Returns a hash function implementing the MurmurHash3 algorithm, 32-bit x86 variant, with the given seed value- Parameters:
seed- the 32-bit seed value- Returns:
- a MurmurHash3 32-bit/x86 stateless integer hash
- Throws:
UnsupportedOperationException- if no provider is available
-
murmur3_128
Returns a hash function implementing the MurmurHash3 algorithm, 128-bit x64 variant, with a seed of 0.- Returns:
- a MurmurHash3 128-bit/x64 stateful hash
- Throws:
UnsupportedOperationException- if no provider is available
-
murmur3_128
Returns a hash function implementing the MurmurHash3 algorithm, 128-bit x64 variant, with the given seed value.- Parameters:
seed- the 32-bit seed value- Returns:
- a MurmurHash3 128-bit/x64 stateful hash
- Throws:
UnsupportedOperationException- if no provider is available
-
sipHash24
Returns a hash function implementing the SipHash-2-4 algorithm (64 bits) with the default seed,00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F.- Returns:
- a SipHash-2-4 stateless long integer hash
- Throws:
UnsupportedOperationException- if no provider is available
-
sipHash24
Returns a hash function implementing the SipHash-2-4 algorithm (64 bits) with the given seed value.- Parameters:
seedLow- the low-order 64 bits of the seedseedHigh- the high-order 64 bits of the seed- Returns:
- a SipHash-2-4 stateless long integer hash
- Throws:
UnsupportedOperationException- if no provider is available
-
md5
Returns a hash function implementing the MD5 algorithm (128 bits).- Returns:
- an MD5 stateful hash
- Throws:
UnsupportedOperationException- if no provider is available
-
sha1
Returns a hash function implementing the SHA-1 algorithm (160 bits).- Returns:
- a SHA-1 stateful hash
- Throws:
UnsupportedOperationException- if no provider is available
-
sha256
Returns a hash function implementing the SHA-256 algorithm (256 bits).- Returns:
- a SHA-256 stateful hash
- Throws:
UnsupportedOperationException- if no provider is available
-
sha384
Returns a hash function implementing the SHA-384 algorithm (384 bits).- Returns:
- a SHA-384 stateful hash
- Throws:
UnsupportedOperationException- if no provider is available
-
sha512
Returns a hash function implementing the SHA-512 algorithm (512 bits).- Returns:
- a SHA-512 stateful hash
- Throws:
UnsupportedOperationException- if no provider is available
-