DigestUtils { public static boolean isSha256Hash(@NonNull String hash) { return Pattern.compile(SHA256_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 testIsSha256Hash() { assertTrue(DigestUtils.isSha256Hash(sha256HashBinary)); assertTrue(DigestUtils.isSha256Hash(sha256HashUnicode)); assertFalse(DigestUtils.isSha256Hash(md5HashBinary)); assertFalse(DigestUtils.isSha256Hash(md5HashUnicode)); assertFalse(DigestUtils.isSha256Hash("")); assertFalse(DigestUtils.isSha256Hash(unicodeStr)); }