is.logi.crypto.hash
Class SHA1State

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

public class SHA1State
extends HashState

An object of this class holds the state of a SHA-1 fingerprint still being calculated.

This class actually uses java.security.MessageDigest to do all the work.

Author:
Logi Ragnarsson (logir@hi.is)

Fields inherited from class is.logi.crypto.Crypto
BIT, cdsPath, keySource, NIBBLE, primeCertainty, random
 
Constructor Summary
SHA1State()
          Create a new clear SHA1State.
 
Method Summary
 int blockSize()
          Return the number of bytes needed to make a valid hash.
 Fingerprint calculate()
          Return a Fingerprint for the curret state, without destroying the state.
 java.lang.String getName()
          The name of the algorithm is "MD5".
 int hashSize()
          Returns the size of a fingerprint in bytes.
 void reset()
          Reset the object.
 void update(byte[] buffer, int offset, int length)
          Update the fingerprint state with the bytes from buf[offset, offset+length-1].
 
Methods inherited from class is.logi.crypto.hash.HashState
create, update, update
 
Methods inherited from class is.logi.crypto.Crypto
binString, binString, equal, equalRelaxed, equalSub, fromHexNibble, fromHexString, fromString, fromString, hexString, hexString, hexString, hexString, makeClass, makeInt, makeLong, makeSessionKey, pastSpace, pickBits, pickBits, readInt, writeBytes, writeBytes, writeInt
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SHA1State

public SHA1State()
Create a new clear SHA1State.
Method Detail

getName

public java.lang.String getName()
The name of the algorithm is "MD5".
Overrides:
getName in class HashState

reset

public void reset()
Reset the object.
Overrides:
reset in class HashState

update

public void update(byte[] buffer,
                   int offset,
                   int length)
Update the fingerprint state with the bytes from buf[offset, offset+length-1].
Overrides:
update in class HashState

calculate

public Fingerprint calculate()
Return a Fingerprint for the curret state, without destroying the state.
Overrides:
calculate in class HashState

blockSize

public 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.
Overrides:
blockSize in class HashState

hashSize

public int hashSize()
Returns the size of a fingerprint in bytes.
Overrides:
hashSize in class HashState


Copyright 1997-1999 Logi Ragnarsson