All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class is.logi.crypto.hash.HashState

java.lang.Object
   |
   +----is.logi.crypto.Crypto
           |
           +----is.logi.crypto.hash.HashState

public abstract class HashState
extends Crypto
An object of this class holds the status of a fingerprint still being calculated.

A fingerprint state object can be repeatedly updated with data. At any time a Fingerprint object can be requested for the data that has then been added to the fingerprint state.

Author:
Logi Ragnarsson (logir@hi.is)
See Also:
SHA1State, Fingerprint, Signature

Constructor Index

 o HashState()

Method Index

 o blockSize()
Return the number of bytes needed to make a valid hash.
 o calculate()
Return a fingerprint for the curret state, without destroying the state.
 o create(String)
Create a HashState object for the named fingerprint algorithm.
 o getName()
Return the name of the algorithm used by this HashState object.
 o hashSize()
Returns the size of a fingerprint in bytes.
 o reset()
Reset the state.
 o update(byte[])
Update the fingerprint state with the bytes from buf.
 o update(byte[], int, int)
Update the fingerprint state with the bytes from buf[offset, offset+length-1].
 o update(String)
Update the fingerprint state with the characters from s.

Constructors

 o HashState
 public HashState()

Methods

 o create
 public static HashState create(String algorithm) throws InvalidCDSException
Create a HashState object for the named fingerprint algorithm.

Throws: InvalidCDSException
if a HashState object for the named algorithm could not be created.
 o getName
 public abstract String getName()
Return the name of the algorithm used by this HashState object.

 o reset
 public abstract void reset()
Reset the state.

 o update
 public abstract void update(byte buf[],
                             int offset,
                             int length)
Update the fingerprint state with the bytes from buf[offset, offset+length-1].

 o update
 public void update(byte buf[])
Update the fingerprint state with the bytes from buf.

 o update
 public void update(String s)
Update the fingerprint state with the characters from s.

 o calculate
 public abstract Fingerprint calculate()
Return a fingerprint for the curret state, without destroying the state.

 o blockSize
 public abstract int blockSize()
Return the number of bytes needed to make a valid hash. If a multiple of this number of bytes is hashed, no padding is needed. If no such value exists, returns 0.

 o hashSize
 public abstract int hashSize()
Returns the size of a fingerprint in bytes.


All Packages  Class Hierarchy  This Package  Previous  Next  Index