Here you can find the source of sha1(String src)
public static String sha1(String src) throws Exception
//package com.java2s; /**//from w w w . ja v a2 s . c o m * MezzoMedia Developed by Java <br> * * @Copyright 2010 by Solution Development Team, MezzoMedia, Inc. All rights reserved. * * This software is the confidential and proprietary information of MezzoMedia, Inc. <br> * You shall not disclose such Confidential Information and shall use it only <br> * in accordance with the terms of the license agreement you entered into with MezzoMedia. */ import java.security.MessageDigest; import sun.misc.BASE64Encoder; public class Main { public static String sha1(String src) throws Exception { MessageDigest md = MessageDigest.getInstance("SHA1"); //java.security.MessageDigest byte[] hashBytes = md.digest(src.getBytes()); BASE64Encoder b64e = new BASE64Encoder(); //sun.misc.BASE64Encoder String hash = b64e.encode(hashBytes); return hash; } }