StringUtils { public static String getChecksum(final String s) throws IOException { try { final MessageDigest md = MessageDigest.getInstance(ALGORITHM_SHA_256); try (final InputStream is = new ByteArrayInputStream(s.getBytes(StandardCharsets.UTF_8)); DigestInputStream dis = new DigestInputStream(is, md)) { final byte[] buf = new byte[4096]; while (dis.read(buf) != -1) {} final byte[] digest = md.digest(); final StringBuilder sb = new StringBuilder(64); for (final int b : digest) { sb.append(Character.forDigit(b >> 4 & 0xF, 16)); sb.append(Character.forDigit(b & 0xF, 16)); } return sb.toString(); } } catch (NoSuchAlgorithmException e) { throw new IOException(e); } }  static String replace(final String string, final String target, final String replacement); static boolean contains(final String name, final String target); static boolean isMatchCamelCase(final String name, final String target); static String getChecksum(final String s); static String escapeJava(final String s);  }
@Test public void testGetChecksum() throws IOException { assertEquals( "b5d4045c3f466fa91fe2cc6abe79232a1a57cdf104f7a26e716e0a1e2789df78", StringUtils.getChecksum("ABC")); }