org.gregoire.util.crypto
Class SHA1

java.lang.Object
  extended byorg.gregoire.util.crypto.SHA1

public class SHA1
extends java.lang.Object

SHA-1 message digest implementation

Version:
August 10, 2001
Author:
Markus Hahn

Field Summary
static int DIGEST_SIZE
          size of a SHA-1 digest in octets
 
Constructor Summary
SHA1()
          constructor
 
Method Summary
 void clear()
          clears all data, use reset() to start again
 void finalize()
          finalizes the digest
 byte[] getDigest()
          gets the digest
 void reset()
          initializes or resets the hasher for a new session respectively
 boolean selfTest()
          runs a selftest
 java.lang.String toString()
          makes a binhex string representation of the current digest
 void update(byte bB)
          adds a single byte to the digest
 void update(byte[] data)
          adds a byte array to the digest
 void update(java.lang.String sData)
          adds an ASCII string to the digest
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

DIGEST_SIZE

public static final int DIGEST_SIZE
size of a SHA-1 digest in octets

See Also:
Constant Field Values
Constructor Detail

SHA1

public SHA1()
constructor

Method Detail

clear

public void clear()
clears all data, use reset() to start again


reset

public void reset()
initializes or resets the hasher for a new session respectively


update

public void update(byte bB)
adds a single byte to the digest


update

public void update(byte[] data)
adds a byte array to the digest


update

public void update(java.lang.String sData)
adds an ASCII string to the digest


finalize

public void finalize()
finalizes the digest


getDigest

public byte[] getDigest()
gets the digest

Returns:
the digst bytes as an array if DIGEST_SIZE bytes

toString

public java.lang.String toString()
makes a binhex string representation of the current digest

Returns:
the string representation

selfTest

public boolean selfTest()
runs a selftest

Returns:
true: selftest passed / false: selftest failed


Copyright © Paul Gregoire, All Rights Reserved.