fr.cryptohash
Class HAVAL128_5

java.lang.Object
  extended by fr.cryptohash.DigestEngine
      extended by fr.cryptohash.HAVAL128_5
All Implemented Interfaces:
Digest

public class HAVAL128_5
extends DigestEngine

This class implements HAVAL with 128-bit output and 5 passes.

 ==========================(LICENSE BEGIN)============================

 Copyright (c) 2007-2010  Projet RNRT SAPHIR
 
 Permission is hereby granted, free of charge, to any person obtaining
 a copy of this software and associated documentation files (the
 "Software"), to deal in the Software without restriction, including
 without limitation the rights to use, copy, modify, merge, publish,
 distribute, sublicense, and/or sell copies of the Software, and to
 permit persons to whom the Software is furnished to do so, subject to
 the following conditions:
 
 The above copyright notice and this permission notice shall be
 included in all copies or substantial portions of the Software.
 
 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
 EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
 IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
 CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
 TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
 SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

 ===========================(LICENSE END)=============================
 


Constructor Summary
HAVAL128_5()
          Create the object.
 
Method Summary
 Digest copy()
          Clone the current state.
protected  Digest copyState(fr.cryptohash.HAVALCore dst)
           
protected  void doInit()
          This function is called at object creation time; the implementation should use it to perform initialization tasks.
protected  void doPadding(byte[] output, int outputOffset)
          Perform the final padding and store the result in the provided buffer.
protected  void engineReset()
          Reset the hash algorithm state.
 int getBlockLength()
          Return the "block length" for the hash function.
 int getDigestLength()
          Get the natural hash function output length (in bytes).
protected  void processBlock(byte[] data)
          Process one block of data.
 java.lang.String toString()
          Get the display name for this function (e.g.
 
Methods inherited from class fr.cryptohash.DigestEngine
copyState, digest, digest, digest, flush, getBlockBuffer, getBlockCount, getInternalBlockLength, reset, update, update, update
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

HAVAL128_5

public HAVAL128_5()
Create the object.

Method Detail

getDigestLength

public int getDigestLength()
Description copied from interface: Digest
Get the natural hash function output length (in bytes).

Returns:
the digest output length (in bytes)
See Also:
Digest

copy

public Digest copy()
Description copied from interface: Digest
Clone the current state. The returned object evolves independantly of this object.

Returns:
the clone
See Also:
Digest

copyState

protected Digest copyState(fr.cryptohash.HAVALCore dst)
See Also:
DigestEngine

getBlockLength

public int getBlockLength()
Description copied from interface: Digest

Return the "block length" for the hash function. This value is naturally defined for iterated hash functions (Merkle-Damgard). It is used in HMAC (that's what the HMAC specification names the "B" parameter).

If the function is "block-less" then this function may return -n where n is an integer such that the block length for HMAC ("B") will be inferred from the key length, by selecting the smallest multiple of n which is no smaller than the key length. For instance, for the Fugue-xxx hash functions, this function returns -4: the virtual block length B is the HMAC key length, rounded up to the next multiple of 4.

Returns:
the internal block length (in bytes), or -n
See Also:
Digest

engineReset

protected void engineReset()
Description copied from class: DigestEngine
Reset the hash algorithm state.

Specified by:
engineReset in class DigestEngine
See Also:
DigestEngine

doPadding

protected void doPadding(byte[] output,
                         int outputOffset)
Description copied from class: DigestEngine
Perform the final padding and store the result in the provided buffer. This method shall call DigestEngine.flush() and then DigestEngine.update(byte) with the appropriate padding data in order to get the full input data.

Specified by:
doPadding in class DigestEngine
Parameters:
output - the output buffer
outputOffset - the output offset
See Also:
DigestEngine

doInit

protected void doInit()
Description copied from class: DigestEngine
This function is called at object creation time; the implementation should use it to perform initialization tasks. After this method is called, the implementation should be ready to process data or meaningfully honour calls such as Digest.getDigestLength().

Specified by:
doInit in class DigestEngine
See Also:
DigestEngine

processBlock

protected void processBlock(byte[] data)
Description copied from class: DigestEngine
Process one block of data.

Specified by:
processBlock in class DigestEngine
Parameters:
data - the data block
See Also:
DigestEngine

toString

public java.lang.String toString()
Description copied from interface: Digest

Get the display name for this function (e.g. "SHA-1" for SHA-1).

Specified by:
toString in interface Digest
Overrides:
toString in class java.lang.Object
See Also:
Digest