long result;
MessageDigest md;
md =
new MessageDigest("sha-160")
{
private final Sha160 adaptee = new Sha160();
public byte[] engineDigest()
{
return adaptee.digest();
}
public int engineDigest(byte[] buf, int offset, int len)
throws java.security.DigestException
{
int result = adaptee.hashSize();
if (len < result)
throw new java.security.DigestException();
System.arraycopy(adaptee.digest(), 0, buf, offset, result);
return result;
}
public int engineGetDigestLength()
{
return adaptee.hashSize();
}
public void engineReset()
{
adaptee.reset();
}
public void engineUpdate(byte input)
{
adaptee.update(input);
}
public void engineUpdate(byte[] input, int offset, int len)
{
adaptee.update(input, offset, len);
}
};
DigestOutputStream digest_out =
new DigestOutputStream(nullOutputStream, md);