public static String sha1(final String string) throws NoSuchAlgorithmException {
  final MessageDigest digest=MessageDigest.getInstance("SHA-1");
  digest.reset();
  final byte[] data=digest.digest(string.getBytes());
  return String.format("%0" + (data.length * 2) + "X",new BigInteger(1,data));
}

public static String sha1 ( final String string ) throws NoSuchAlgorithmException { final MessageDigest digest = MessageDigest . getInstance ( "SHA-1" ) ; digest . reset ( ) ; final byte [ ] data = digest . digest ( string . getBytes ( ) ) ; return String . format ( "%0" + ( data . length * 2 ) + "X" , new BigInteger ( 1 , data ) ) ; }
makes an sha1 hash of the given string
