import java.io.UnsupportedEncodingException;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;

/**
 * Test SHA-1 digest computation
 *
 * @author Roedy Green
 * @version 1.0
 * @since 2004-06-07
 */
public class Sha
   {

   /**
    * test harness
    *
    * @param args not used
    */
   public static void main ( String[] args ) throws UnsupportedEncodingException, NoSuchAlgorithmException
   {

      byte[] theTextToDigestAsBytes = "The quick brown fox jumped over the lazy dog's back".getBytes( "8859_1" /* encoding */ );
      MessageDigest md = MessageDigest.getInstance( "SHA" );
      md.update( theTextToDigestAsBytes );
      byte[] digest = md.digest();
      System.out.println( digest.length );
      // 20 bytes, 160 bits long
   }
   }

