@Test public void cloneDigest() throws Exception { Digest d1Orig = new SHA512Digest(); Digest d1Clone = RSAOAEPDigestFactory.cloneDigest(d1Orig); assertTrue(d1Clone instanceof SHA512Digest); assertNotEquals(d1Orig, d1Clone); }
public static Digest cloneDigest(Digest digest) { try { return digest.getClass().newInstance(); } catch (InstantiationException | IllegalAccessException exc) { exc.printStackTrace(); return digest; } }
RSAOAEPDigestFactory { public static Digest cloneDigest(Digest digest) { try { return digest.getClass().newInstance(); } catch (InstantiationException | IllegalAccessException exc) { exc.printStackTrace(); return digest; } } }
RSAOAEPDigestFactory { public static Digest cloneDigest(Digest digest) { try { return digest.getClass().newInstance(); } catch (InstantiationException | IllegalAccessException exc) { exc.printStackTrace(); return digest; } }  }
RSAOAEPDigestFactory { public static Digest cloneDigest(Digest digest) { try { return digest.getClass().newInstance(); } catch (InstantiationException | IllegalAccessException exc) { exc.printStackTrace(); return digest; } }  @Nullable static Digest getDigestByName(String digestName); static Digest cloneDigest(Digest digest); }
RSAOAEPDigestFactory { public static Digest cloneDigest(Digest digest) { try { return digest.getClass().newInstance(); } catch (InstantiationException | IllegalAccessException exc) { exc.printStackTrace(); return digest; } }  @Nullable static Digest getDigestByName(String digestName); static Digest cloneDigest(Digest digest);  }