Here you can find the source of sha1(String ori)
public static String sha1(String ori)
//package com.java2s; import java.math.BigInteger; import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; public class Main { public static String sha1(String ori) { try {//from www. j av a 2s .c o m MessageDigest md = MessageDigest.getInstance("sha1"); md.update(ori.getBytes(), 0, ori.length()); BigInteger i = new BigInteger(1, md.digest()); return String.format("%1$040x", i); } catch (NoSuchAlgorithmException e) { e.printStackTrace(); return ori; } } }