DigestUtils { public static boolean isMd5Hash(@NonNull String hash) { return Pattern.compile(MD5_PATTERN).matcher(hash).matches(); }  static String makeSha256Hash(@NonNull FileInputStream is); static String makeMd5Hash(@NonNull FileInputStream is); static String makeSha256Hash(@NonNull byte[] bytes); static String makeMd5Hash(@NonNull byte[] bytes); static boolean isMd5Hash(@NonNull String hash); static boolean isSha256Hash(@NonNull String hash);  }
@Test public void testIsMd5Hash() { assertTrue(DigestUtils.isMd5Hash(md5HashBinary)); assertTrue(DigestUtils.isMd5Hash(md5HashUnicode)); assertFalse(DigestUtils.isMd5Hash(sha256HashBinary)); assertFalse(DigestUtils.isMd5Hash(sha256HashUnicode)); assertFalse(DigestUtils.isMd5Hash("")); assertFalse(DigestUtils.isMd5Hash(unicodeStr)); }