Skip to content

Instantly share code, notes, and snippets.

@benfb
Created December 2, 2012 19:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save benfb/4190534 to your computer and use it in GitHub Desktop.
Save benfb/4190534 to your computer and use it in GitHub Desktop.
VigenereRunner
import java.util.Scanner;
public class VigenereRunner
{
public static void main(String[] args)
{
//instantiate a Scanner object
Scanner scan = new Scanner(System.in);
//prompt the user for the text to encrypt
System.out.println("Plain text: ");
//assign user input to a variable
String pt = scan.next();
//prompt the user for a keyword to use
System.out.println("Keyword: ");
//assign user input to a variable
String key = scan.next();
//instantitate a Vigenere object and pass in the user input
Vigenere vigenere = new Vigenere(pt, key);
//text your program
System.out.println(vigenere.equals(vigenere)); //tests to see if the key is the same as the original message
System.out.println(vigenere.encrypt()); //encrypts and prints
System.out.println(vigenere.decrypt()); //decrypts and prints
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment