Here you can find the source of SHA1(String text)
public static byte[] SHA1(String text) throws NoSuchAlgorithmException, UnsupportedEncodingException
//package com.java2s; import java.io.UnsupportedEncodingException; import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; public class Main { static public final String SHA1 = "http://www.w3.org/2000/09/xmldsig#hmac-sha1"; public static byte[] SHA1(String text) throws NoSuchAlgorithmException, UnsupportedEncodingException { MessageDigest md;/* w w w . java 2 s .c om*/ md = MessageDigest.getInstance("SHA-1"); byte[] sha1hash = new byte[40]; md.update(text.getBytes(), 0, text.length()); // "iso-8859-1" sha1hash = md.digest(); return (sha1hash); } }