Here you can find the source of encryptByUsingSha1(String passwd)
public static String encryptByUsingSha1(String passwd)
//package com.java2s; import java.security.MessageDigest; public class Main { public static String encryptByUsingSha1(String passwd) { try {//ww w.j av a2 s .c om MessageDigest md = MessageDigest.getInstance("SHA-1"); String clearPassword = passwd; md.update(clearPassword.getBytes()); byte[] digestedPassword = md.digest(); return new String(digestedPassword); } catch (java.security.NoSuchAlgorithmException e) { System.out.println("Rats, SHA-1 doesn't exist"); System.out.println(e.toString()); return null; } } }