Hi,
I need help with the error message above. It looks like I have an extra curl bracket (which is true) but when I remove it I get even more errors as my PasswordGenerator class is not recognized when I remove this curl brack. Could someone out there help?
The code is shown bellow.
package SkeyClass;
import java.util.StringTokenizer;
import java.awt.*;
import java.util.*;
import java.io.*;
import java.lang.*;
public class Main{
/** Creates a new instance of Main */
public Main() {
}
/**
* @param args the command line arguments
*/
public static void main(String argv[]) {
String seed, passphrase;
int seq;
PasswordGenerator otpwd;
int hashalg;
String hashtype;
if ((argv.length < 3) || (argv.length > 4)) {
System.err.println("usage: jotp sequence seed passphrase" +
"[md4|md5]");
return;
}
seq = new Integer(argv[0]).intValue();
seed = new String(argv[1]);
passphrase = new String(argv[2]);
if (argv[3].equals("5") || argv[3].equals("md5") ||
argv[3].equals("MD5")) {
hashtype = "md5";
hashalg = PasswordGenerator.MD5;
}
otpwd = new PasswordGenerator(seq, seed, passphrase);
System.out.println("Using " + hashtype + ". Thinking...");
otpwd.calc();
System.out.println(otpwd);
}
public boolean action(Event evt, Object arg) {
String tmpstr, tmpstr2, seed, passphrase;
int seq, hashalg;
PasswordGenerator otpwd;
/* Split up challenge */
tmpstr = chaltf.getText(); //please enter paraphrase
StringTokenizer st = new StringTokenizer(tmpstr);
if (st.countTokens() != 2) {
otptf.setText("bogus challenge"); //printout this message
return true;
}
tmpstr2 = st.nextToken();
try {
seq = (Integer.parseInt(tmpstr2));
} catch (NumberFormatException e) {
otptf.setText("bogus sequence number '" + tmpstr2 + "'");
return true;
}
seed = st.nextToken();
passphrase = pwtf.getText();
otptf.setText("Okay, thinking...");
otpwd = new PasswordGenerator(seq, seed, passphrase);
otpwd.calc();
otptf.setText(otpwd.toString());
return true;
}
}
}
Main.java:88: 'class' or 'interface' expected
Main.java:88: 'class' or 'interface' expected
I need help with the error message above. It looks like I have an extra curl bracket (which is true) but when I remove it I get even more errors as my PasswordGenerator class is not recognized when I remove this curl brack. Could someone out there help?
The code is shown bellow.
package SkeyClass;
import java.util.StringTokenizer;
import java.awt.*;
import java.util.*;
import java.io.*;
import java.lang.*;
public class Main{
/** Creates a new instance of Main */
public Main() {
}
/**
* @param args the command line arguments
*/
public static void main(String argv[]) {
String seed, passphrase;
int seq;
PasswordGenerator otpwd;
int hashalg;
String hashtype;
if ((argv.length < 3) || (argv.length > 4)) {
System.err.println("usage: jotp sequence seed passphrase" +
"[md4|md5]");
return;
}
seq = new Integer(argv[0]).intValue();
seed = new String(argv[1]);
passphrase = new String(argv[2]);
if (argv[3].equals("5") || argv[3].equals("md5") ||
argv[3].equals("MD5")) {
hashtype = "md5";
hashalg = PasswordGenerator.MD5;
}
otpwd = new PasswordGenerator(seq, seed, passphrase);
System.out.println("Using " + hashtype + ". Thinking...");
otpwd.calc();
System.out.println(otpwd);
}
public boolean action(Event evt, Object arg) {
String tmpstr, tmpstr2, seed, passphrase;
int seq, hashalg;
PasswordGenerator otpwd;
/* Split up challenge */
tmpstr = chaltf.getText(); //please enter paraphrase
StringTokenizer st = new StringTokenizer(tmpstr);
if (st.countTokens() != 2) {
otptf.setText("bogus challenge"); //printout this message
return true;
}
tmpstr2 = st.nextToken();
try {
seq = (Integer.parseInt(tmpstr2));
} catch (NumberFormatException e) {
otptf.setText("bogus sequence number '" + tmpstr2 + "'");
return true;
}
seed = st.nextToken();
passphrase = pwtf.getText();
otptf.setText("Okay, thinking...");
otpwd = new PasswordGenerator(seq, seed, passphrase);
otpwd.calc();
otptf.setText(otpwd.toString());
return true;
}
}
}
Main.java:88: 'class' or 'interface' expected
Main.java:88: 'class' or 'interface' expected