DigestUtil { private static final byte[] getDigestAsBytes( String _source, Charset _charset, DigestAlgorithm _alg) { return DigestUtil.getDigestAsBytes(_source.getBytes(_charset), _alg); }  static final String getDigestAsString(
      String _source, Charset _charset, DigestAlgorithm _alg); static String bytesToHex(byte[] bytes);  }
@Test public void testGetDigestAsBytes() throws IOException { final String text = "foo bar baz"; final String sha1 = DigestUtil.getDigestAsString(text, StandardCharsets.UTF_8, DigestAlgorithm.SHA1) .toLowerCase(); final String expected_sha1 = "c7567e8b39e2428e38bf9c9226ac68de4c67dc39"; assertEquals(expected_sha1, sha1); }