ShortenedDigestpublic class ShortenedDigest extends Object implements org.bouncycastle.crypto.ExtendedDigestWrapper class that reduces the output length of a particular digest to
only the first n bytes of the digest function. |
Fields Summary |
---|
private org.bouncycastle.crypto.ExtendedDigest | baseDigest | private int | length |
Constructors Summary |
---|
public ShortenedDigest(org.bouncycastle.crypto.ExtendedDigest baseDigest, int length)Base constructor.
if (baseDigest == null)
{
throw new IllegalArgumentException("baseDigest must not be null");
}
if (length > baseDigest.getDigestSize())
{
throw new IllegalArgumentException("baseDigest output not large enough to support length");
}
this.baseDigest = baseDigest;
this.length = length;
|
Methods Summary |
---|
public int | doFinal(byte[] out, int outOff)
byte[] tmp = new byte[baseDigest.getDigestSize()];
baseDigest.doFinal(tmp, 0);
System.arraycopy(tmp, 0, out, outOff, length);
return length;
| public java.lang.String | getAlgorithmName()
return baseDigest.getAlgorithmName() + "(" + length * 8 + ")";
| public int | getByteLength()
return baseDigest.getByteLength();
| public int | getDigestSize()
return length;
| public void | reset()
baseDigest.reset();
| public void | update(byte in)
baseDigest.update(in);
| public void | update(byte[] in, int inOff, int len)
baseDigest.update(in, inOff, len);
|
|