DefaultDigestFactory extends AbstractBcDigestFactory implements DigestCalculatorProvider { @Override public Digest getInstance() { throw new UnsupportedOperationException("Sorry, cannot get an instance without a determined algorithm."); }  @Override org.bouncycastle.crypto.Digest getDigestInstance(); @Override AlgorithmIdentifier getAlgorithmIdentifier(); @Override Digest getInstance(); @Override Digest getInstance(byte[] encoded); @Override DigestCalculator get(final AlgorithmIdentifier algorithmIdentifier);  }
@Test void testDefaultDigestFactory() throws Exception { assertThat(factory.getInstance(MD5_DIGEST_ALGO.getEncoded()).digest(BYTES), equalTo(md5Digest)); assertThat(factory.getInstance(SHA1_DIGEST_ALGO.getEncoded()).digest(BYTES), equalTo(sha1Digest)); assertThat(factory.getInstance(SHA224_DIGEST_ALGO.getEncoded()).digest(BYTES), equalTo(sha224Digest)); assertThat(factory.getInstance(SHA256_DIGEST_ALGO.getEncoded()).digest(BYTES), equalTo(sha256Digest)); assertThat(factory.getInstance(SHA384_DIGEST_ALGO.getEncoded()).digest(BYTES), equalTo(sha384Digest)); assertThat(factory.getInstance(SHA512_DIGEST_ALGO.getEncoded()).digest(BYTES), equalTo(sha512Digest)); }