### Question:
Crypto { public static MessageDigest getMessageDigest(String algorithm) { try { return MessageDigest.getInstance(algorithm); } catch (NoSuchAlgorithmException e) { LOG.info("Missing message digest algorithm: " + algorithm); throw new RuntimeException(e.getMessage(), e); } } private  Crypto(); static SecureRandom getSecureRandom(); static MessageDigest getMessageDigest(String algorithm); static MessageDigest sha256(); static MessageDigest sha512(); static MessageDigest ripemd160(); static MessageDigest sha3(); static byte[] getKeySeed(String secretPhrase, byte[]... nonces); static byte[] getKeySeed(byte[] secretBytes, byte[]... nonces); static byte[] getPublicKey(byte[] keySeed); static byte[] getPublicKey(String secretPhrase); static byte[] getPrivateKey(byte[] keySeed); static byte[] getPrivateKey(String secretPhrase); static void curve(byte[] Z, byte[] k, byte[] P); static byte[] sign(byte[] message, String secretPhrase); static byte[] sign(byte[] message, byte[] keySeed); static boolean verify(byte[] signature, byte[] message, byte[] publicKey); static byte[] getSharedKey(byte[] myPrivateKey, byte[] theirPublicKey); static byte[] getSharedKey(byte[] myPrivateKey, byte[] theirPublicKey, byte[] nonce); static byte[] aesEncrypt(byte[] plaintext, byte[] key); static byte[] aesGCMEncrypt(byte[] plaintext, byte[] key); static byte[] aesDecrypt(byte[] ivCiphertext, byte[] key); static byte[] aesGCMDecrypt(byte[] ivCiphertext, byte[] key); static String rsEncode(long id); static long rsDecode(String rsString); static boolean isCanonicalPublicKey(byte[] publicKey); static boolean isCanonicalSignature(byte[] signature); static FBElGamalKeyPair getElGamalKeyPair(); static String elGamalDecrypt(String cryptogramm, FBElGamalKeyPair keyPair); static String elGamalEncrypt(String plainText, FBElGamalKeyPair keyPair);  }### Answer:
@Test public void testGetMessageDigest() { String[] algorithms = {"SHA-256", "SHA-512"}; String[] digests = { "1996b1473fbac5f5aa3e2c81e1fb31a5580eb8463bca2b3121ca94a1cfe4cfea", "101e03fa3e90c18825a8286e224f1f680f045d24a8d97b7c813a52fcc7e561cc6eec7ebec83c32c2b949fb0ed0de4473239027f99758fc4d9d28295d0672896b" }; MessageDigest expResult = null; for(int i=0; i<algorithms.length; i++){ MessageDigest result = Crypto.getMessageDigest(algorithms[i]); result.update(plain_data); byte[] d = result.digest(); byte[] ed = Convert.parseHexString(digests[i]); assertArrayEquals(ed, d); } }