Here you can find the source of sha1(String str)
public static String sha1(String str)
//package com.java2s; import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; public class Main { public static String sha1(String str) { try {// www . ja va 2 s.com StringBuffer sb = new StringBuffer(); MessageDigest md = MessageDigest.getInstance("sha1"); md.update(str.getBytes()); byte[] msg = md.digest(); for (byte b : msg) { sb.append(String.format("%02x", b)); } return sb.toString(); } catch (NoSuchAlgorithmException e) { e.printStackTrace(); } return null; } }