Here you can find the source of sha512(String what_to_encode)
public static String sha512(String what_to_encode)
//package com.java2s; import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; public class Main { public static String sha512(String what_to_encode) { final MessageDigest sha512; try {//from w w w . java 2 s . c om sha512 = MessageDigest.getInstance("SHA-512"); } catch (NoSuchAlgorithmException e) { return "404"; } sha512.update(what_to_encode.getBytes()); byte byteData[] = sha512.digest(); StringBuffer sb = new StringBuffer(); for (int i = 0; i < byteData.length; i++) { sb.append(Integer.toString((byteData[i] & 0xff) + 0x100, 16) .substring(1)); } return sb.toString(); } }