Package com.scurrilous.circe
Class Hashes
java.lang.Object
com.scurrilous.circe.Hashes
Static methods to obtain various forms of abstract hash functions. Each
method uses
HashProviders.best(com.scurrilous.circe.HashParameters) to find the best provider for the
given parameters and hash interface, and then calls the corresponding method
on that provider.-
Method Summary
Modifier and TypeMethodDescriptionstatic StatefulHashcreateStateful(HashParameters params) Creates a stateful hash function using the given parameters.static IncrementalIntHashgetIncrementalInt(HashParameters params) Requests an incremental, stateless, int-width hash function with the given parameters.static IncrementalLongHashgetIncrementalLong(HashParameters params) Requests an incremental, stateless, long-width hash function with the given parameters.static StatelessIntHashgetStatelessInt(HashParameters params) Requests a stateless, int-width hash function with the given parameters.static StatelessLongHashgetStatelessLong(HashParameters params) Requests a stateless, long-width hash function with the given parameters.
-
Method Details
-
createStateful
Creates a stateful hash function using the given parameters.- Parameters:
params- the hash algorithm parameters- Returns:
- a stateful hash function
- Throws:
UnsupportedOperationException- if no provider supports the parameters
-
getStatelessInt
Requests a stateless, int-width hash function with the given parameters. Because not all stateless hash functions are incremental, this method may be able to return implementations not supported by or more optimized thangetIncrementalInt(com.scurrilous.circe.HashParameters).- Parameters:
params- the hash algorithm parameters- Returns:
- a stateless int-width hash function
- Throws:
UnsupportedOperationException- if no provider supports the parameters as aStatelessIntHash
-
getStatelessLong
Requests a stateless, long-width hash function with the given parameters. Because not all stateless hash functions are incremental, this method may be able to return implementations not supported by or more optimized thangetIncrementalLong(com.scurrilous.circe.HashParameters).Note that this method may return a less efficient hash function than
getStatelessInt(com.scurrilous.circe.HashParameters)for hashes of 32 bits or less.- Parameters:
params- the hash algorithm parameters- Returns:
- a stateless long-width hash function
- Throws:
UnsupportedOperationException- if no provider supports the parameters as aStatelessLongHash
-
getIncrementalInt
Requests an incremental, stateless, int-width hash function with the given parameters. Note that although an algorithm may be available in incremental form, some potentially more optimized implementations may not support that form, and therefore cannot be provided be this method.- Parameters:
params- the hash algorithm parameters- Returns:
- a stateful int-width hash function
- Throws:
UnsupportedOperationException- if no provider supports the parameters as anIncrementalIntHash
-
getIncrementalLong
Requests an incremental, stateless, long-width hash function with the given parameters. Note that although an algorithm may be available in incremental form, some potentially more optimized implementations may not support that form, and therefore cannot be provided be this method.Also note that this method may return a less efficient hash function than
getIncrementalInt(com.scurrilous.circe.HashParameters)for hashes of 32 bits or less.- Parameters:
params- the hash algorithm parameters- Returns:
- a stateful long-width hash function
- Throws:
UnsupportedOperationException- if no provider supports the parameters as anIncrementalLongHash
-