Here you can find the source of sha256(String base)
public static String sha256(String base) throws Exception
//package com.java2s; import java.security.MessageDigest; public class Main { public static String sha256(String base) throws Exception { MessageDigest digest = MessageDigest.getInstance("SHA-256"); byte[] hash = digest.digest(base.getBytes()); StringBuffer hexString = new StringBuffer(); for (int i = 0; i < hash.length; i++) { String hex = Integer.toHexString(0xff & hash[i]); if (hex.length() == 1) { hexString.append('0'); }/*from w w w . j a v a2 s . c o m*/ hexString.append(hex); } return hexString.toString(); } }