StringUtils { public static String sha1Hash(String s) { if (s == null) { return null; } final MessageDigest messageDigest; try { messageDigest = MessageDigest.getInstance("SHA-1"); } catch (NoSuchAlgorithmException e) { throw new IllegalStateException(e); } final byte[] digest = messageDigest.digest(s.getBytes(Charset.forName("UTF-8"))); return bytesToHex(digest); } private  StringUtils(); static String removeStart(final String str, final String remove); static String capitalize(String self); static String splitCamelCase(String s); static String[] split(final String str, final char separatorChar); static String dateAsIsoString(Date date); static String timestampAsIsoString(long timestamp); static String slugify(String s); static boolean isNotEmpty(String s); static boolean isEmpty(String s); static String asCsv(String[] strings); static String asCsv(Collection<?> values); static String getLogstashStyleDate(); static String getLogstashStyleDate(long time); static String replaceWhitespacesWithDash(String s); static String toCommaSeparatedString(String... strings); static String removeTrailingSlash(String url); static String sha1Hash(String s); static String bytesToHex(byte[] bytes); static String toHexString(long l); static String deDot(String s); static String reDot(String s);  }
@Test public void testSha1Hash() throws Exception { assertEquals("a94a8fe5ccb19ba61c4c0873d391e987982fbbd3", StringUtils.sha1Hash("test")); }