If the PhotonBeetle and Xoodyak digests are re-used after the call to doFinal(), they return differing results for the same input data.
Please see following test code
`
public class DigestTest
{
private static final int DATALEN = 100;
public static void main(final String[] pArgs)
{
checkDigest(new PhotonBeetleDigest());
checkDigest(new XoodyakDigest());
}
private static void checkDigest(final Digest pDigest)
{
/* Obtain some random data */
final byte[] myData = new byte[DATALEN];
final SecureRandom myRandom = new SecureRandom();
myRandom.nextBytes(myData);
/* Update and finalise digest */
final int myHashLen = pDigest.getDigestSize();
final byte[] myFirst = new byte[myHashLen];
pDigest.update(myData, 0, DATALEN);
pDigest.doFinal(myFirst, 0);
/* Reuse the digest */
final byte[] mySecond = new byte[myHashLen];
pDigest.update(myData, 0, DATALEN);
pDigest.doFinal(mySecond, 0);
/* Check that we have the same result */
if (!Arrays.equals(myFirst, mySecond))
{
System.out.println("Digest " + pDigest.getAlgorithmName() + " does not reset properly on doFinal()");
}
}
If the PhotonBeetle and Xoodyak digests are re-used after the call to doFinal(), they return differing results for the same input data.
Please see following test code
` public class DigestTest { private static final int DATALEN = 100;
} `