Package com.scurrilous.circe.impl
Class IntStatelessLongHash
- java.lang.Object
-
- com.scurrilous.circe.impl.IntStatelessLongHash
-
- All Implemented Interfaces:
Hash
,StatelessHash
,StatelessLongHash
public final class IntStatelessLongHash extends java.lang.Object implements StatelessLongHash
Promotes aStatelessIntHash
to aStatelessLongHash
.
-
-
Constructor Summary
Constructors Constructor Description IntStatelessLongHash(StatelessIntHash intHash)
Constructs a newIntStatelessLongHash
that delegates to the givenStatelessIntHash
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.String
algorithm()
Returns the canonical name of this hash algorithm.long
calculate(byte[] input)
Evaluates this hash function for the entire given input array.long
calculate(byte[] input, int index, int length)
Evaluates this hash function for the given range of the given input array.long
calculate(long address, long length)
Evaluates this hash function for the memory with the given address and length.long
calculate(java.nio.ByteBuffer input)
Evaluates this hash function with the remaining contents of the given input buffer.StatefulLongHash
createStateful()
Returns a new instance of stateful version of this hash function.int
length()
Returns the length in bytes of the output of this hash function.boolean
supportsUnsafe()
Returns whether this hash function supports unsafe access to arbitrary memory addresses using methods such asStatefulHash.update(long, long)
,StatelessIntHash.calculate(long, long)
, orIncrementalIntHash.resume(int, long, long)
.
-
-
-
Constructor Detail
-
IntStatelessLongHash
public IntStatelessLongHash(StatelessIntHash intHash)
Constructs a newIntStatelessLongHash
that delegates to the givenStatelessIntHash
.- Parameters:
intHash
- the underlying int-width hash
-
-
Method Detail
-
algorithm
public java.lang.String algorithm()
Description copied from interface:Hash
Returns the canonical name of this hash algorithm.
-
length
public int length()
Description copied from interface:Hash
Returns the length in bytes of the output of this hash function.
-
supportsUnsafe
public boolean supportsUnsafe()
Description copied from interface:Hash
Returns whether this hash function supports unsafe access to arbitrary memory addresses using methods such asStatefulHash.update(long, long)
,StatelessIntHash.calculate(long, long)
, orIncrementalIntHash.resume(int, long, long)
. Such functions are generally implemented in native code.- Specified by:
supportsUnsafe
in interfaceHash
- Returns:
- true if unsafe access is supported, false if not
-
createStateful
public StatefulLongHash createStateful()
Description copied from interface:StatelessLongHash
Returns a new instance of stateful version of this hash function.- Specified by:
createStateful
in interfaceStatelessHash
- Specified by:
createStateful
in interfaceStatelessLongHash
- Returns:
- the stateful version of this hash function
-
calculate
public long calculate(byte[] input)
Description copied from interface:StatelessLongHash
Evaluates this hash function for the entire given input array.- Specified by:
calculate
in interfaceStatelessLongHash
- Parameters:
input
- the input array- Returns:
- the output of the hash function
-
calculate
public long calculate(byte[] input, int index, int length)
Description copied from interface:StatelessLongHash
Evaluates this hash function for the given range of the given input array.- Specified by:
calculate
in interfaceStatelessLongHash
- Parameters:
input
- the input arrayindex
- the starting index of the first input bytelength
- the length of the input range- Returns:
- the output of the hash function
-
calculate
public long calculate(java.nio.ByteBuffer input)
Description copied from interface:StatelessLongHash
Evaluates this hash function with the remaining contents of the given input buffer. This method leaves the buffer position at the limit.- Specified by:
calculate
in interfaceStatelessLongHash
- Parameters:
input
- the input buffer- Returns:
- the output of the hash function
-
calculate
public long calculate(long address, long length)
Description copied from interface:StatelessLongHash
Evaluates this hash function for the memory with the given address and length. The arguments are generally not checked in any way and will likely lead to a VM crash or undefined results if invalid.- Specified by:
calculate
in interfaceStatelessLongHash
- Parameters:
address
- the base address of the inputlength
- the length of the input- Returns:
- the output of the hash function
- See Also:
Hash.supportsUnsafe()
-
-