Here you can find the source of sha(String str)
public static String sha(String str)
//package com.java2s; //License from project: Apache License import java.math.BigInteger; import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; public class Main { public static String sha(String str) { return encode(str, "SHA"); }/* w ww. j av a 2 s . c o m*/ private static String encode(String str, String method) { MessageDigest md = null; String dstr = null; try { md = MessageDigest.getInstance(method); md.update(str.getBytes()); dstr = new BigInteger(1, md.digest()).toString(16); } catch (NoSuchAlgorithmException e) { e.printStackTrace(); } return dstr; } }