Correct javadoc of the hash function signature.
This commit is contained in:
parent
9f2271334d
commit
33d6ddc7f9
|
@ -30,4 +30,20 @@ public interface HashFunction extends HashFunctionIdentity {
|
||||||
* @return the long value of the hash.
|
* @return the long value of the hash.
|
||||||
*/
|
*/
|
||||||
long apply(byte[] buffer, int seed);
|
long apply(byte[] buffer, int seed);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the signature of this function.
|
||||||
|
*
|
||||||
|
* <p>The signature of this function is calculated as:
|
||||||
|
* <pre><code>
|
||||||
|
* int seed = 0;
|
||||||
|
* apply(String.format("%s-%s-%s",
|
||||||
|
* getName().toUpperCase(Locale.ROOT), getSignedness(), getProcess())
|
||||||
|
* .getBytes("UTF-8"), seed);
|
||||||
|
* </code></pre>
|
||||||
|
*
|
||||||
|
* @see HashFunctionIdentity#prepareSignatureBuffer(HashFunctionIdentity)
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
long getSignature();
|
||||||
}
|
}
|
||||||
|
|
|
@ -98,16 +98,18 @@ public interface HashFunctionIdentity {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the signature buffer for a HashFunctionIdentity.
|
* Gets a {@code byte[]} buffer for a HashFunctionIdentity to create a signature. The
|
||||||
* <p>
|
* {@code byte[]} is composed using properties of the hash function as:
|
||||||
* The signature of this function is calculated as:
|
*
|
||||||
* {@code
|
* <pre><code>
|
||||||
* apply( String.format( "%s-%s-%s", getName().toUpperCase( Locale.ROOT ), getSignedness(), getProcess() )
|
* String.format("%s-%s-%s",
|
||||||
* .getBytes( "UTF-8" ), 0 );
|
* getName().toUpperCase(Locale.ROOT), getSignedness(), getProcess())
|
||||||
* }
|
* .getBytes("UTF-8");
|
||||||
* </p>
|
* </code></pre>
|
||||||
|
*
|
||||||
* @param identity The HashFunctionIdentity to create the buffer for.
|
* @param identity The HashFunctionIdentity to create the buffer for.
|
||||||
* @return the signature buffer for the identity
|
* @return the signature buffer for the identity
|
||||||
|
* @see #getSignature()
|
||||||
*/
|
*/
|
||||||
static byte[] prepareSignatureBuffer(final HashFunctionIdentity identity) {
|
static byte[] prepareSignatureBuffer(final HashFunctionIdentity identity) {
|
||||||
return String.format("%s-%s-%s",
|
return String.format("%s-%s-%s",
|
||||||
|
@ -144,13 +146,13 @@ public interface HashFunctionIdentity {
|
||||||
String getProvider();
|
String getProvider();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the signature of this function. <p> The signature of this function is
|
* Gets the signature of this function. The signature is the output of the hash function
|
||||||
* calculated as: {@code
|
* when applied to a set of bytes composed using properties of the hash function.
|
||||||
* apply( String.format( "%s-%s-%s", getName(), getSignedness(), getProcess() )
|
*
|
||||||
* .getBytes( "UTF-8" ), 0 );
|
* <p>Implementations should define the method used to generate the signature.
|
||||||
* } </p>
|
|
||||||
*
|
*
|
||||||
* @return the signature of this function.
|
* @return the signature of this function.
|
||||||
|
* @see #prepareSignatureBuffer(HashFunctionIdentity)
|
||||||
*/
|
*/
|
||||||
long getSignature();
|
long getSignature();
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue