package sha;
import java.security.MessageDigest;
/**
 *
 * @author deepak
 */
public class Sha {
public static void main(String[] args) throws Exception{
                    MessageDigest sha = MessageDigest.getInstance("SHA-1");
                         byte [] i1 = args[0].getBytes("UTF8");
                          sha.update(i1);
                          byte[] hash = sha.digest();
                          System.out.println ("Result: Success");
            // Display plain text and digest
               System.out.println ("Original plain text was : " + args[0]);
                System.out.println ("Digested text is     : " + new String (hash));
                 System.out.println ("Program execution was successful ...");
        }
}

i am getting error in:
byte [] i1 = args[0].getBytes("UTF8");

line no. 12

plss help me to remove it...

Probably args[0] doesn't exist. This is the array of arguments passed to the program, so perhaps when you run the program with "java Sha" you should add whatever args are required, as in "java Sha arg1".

thanks a lot for your reply..

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.