HashUtil { public static String hashSHA512(final String s) throws NoSuchAlgorithmException { return hashInBase64(s, SHA_512); } private  HashUtil(); static String hashSHA256(final String s); static String hashSHA384(final String s); static String hashSHA512(final String s); static String base64FromUtf8Bytes(final byte[] bytes); static String hashInBase64(final String s, final String algo); static final String SHA_512; static final String SHA_384; static final String SHA_256; }
@Test public void testHashSHA512() throws NoSuchAlgorithmException { assertEquals("ghMAt8A5BbfxVoJuLHe/Kg8InW4UDyJH9pCM6T7xTo6WngUisFwvrn62TWu6IvYJKHhwKhKqFeY8+s9zSXQJ2g==", HashUtil.hashSHA512("Hello webfirmframework")); }