www.pudn.com > encryption.rar > Hash.java
/*
Christoforos Pirillos @ Villanova University - May 1999
based on code from the book "Java Network Programming" by Hughes
*/
package encryption;
/**This class is the generic superclass for all hash functions. Hash
functions are used to compute message digests; a message digest is, as the
name suggests, a summary of the message.*/
public abstract class Hash {
/**Returns a digest from the subarray of text consisting of len bytes,
from offset off.*/
public abstract byte[] digest (byte[] text, int off, int len);
/**Computes a digest for the whole array text using the previous method.*/
public byte[] digest (byte[] text) {
return digest (text, 0, text.length);
}
/**Returns the digest size returned by this algorithm. MD5 returns 16
bytes. SHS returns 20 bytes.*/
public abstract int digestSize();
} /*end of class Hash*/