src/ie/gmit/sw/ai/CipherBreaker.java
public static void testShuffler() {
		Shuffler shuffler = new Shuffler();
		Filter filter = new Filter();
		Playfair playfair = new Playfair();
		
		//generating a random key
		String alphabet = "A B C D E F G H I J K L M N O P Q R S T U V W X Y Z";
		alphabet = filter.format(alphabet);
		char[] chars = alphabet.toCharArray();
		char[] randKey = shuffler.generateRandomKey(chars);
		System.out.print("Randomly generated key: ");
		System.out.print(randKey);
		
		//setting the key and generating the key + matrix in playfair class
		String key = new String(randKey);
		playfair.setKey(key);
		playfair.generateKey();
		playfair.generateMatrix();
		
		//getting the matrix generated in playfair class and setting shuffler matrix
		char[][] matrix = playfair.getMatrix();
		shuffler.setMatrix(matrix);
		shuffler.setParent(playfair.getKey());
		System.out.println("\nKey Matrix: \n");
		shuffler.printMatrix();
		
		//testing shuffling methods
		//shuffler.shuffleKey(shuffler.getParent());
		//System.out.println("\n");
		//shuffler.printMatrix();
		
		//shuffler.swapRandomLetters();
		//System.out.println("\n");
		//shuffler.printMatrix();
		
		//shuffler.swapRandomRows();
		//System.out.println("\n");
		//shuffler.printMatrix();
		
		//shuffler.swapRandomCols();
		//System.out.println("\n");
		//shuffler.printMatrix();
		
		//shuffler.flipAllRows();
		//System.out.println("\n");
		//shuffler.printMatrix();
		
		//shuffler.flipAllCols();
		//System.out.println("\n");
		//shuffler.printMatrix();
		
		//shuffler.reverseKey();
		//System.out.println("\n");
		//shuffler.printMatrix();
	}
//quick test to see if shuffler is working correctly
quick test to see if shuffler is working correctly
quick test to see if shuffler is working correctly
public static void testShuffler() {
		Shuffler shuffler = new Shuffler();
		Filter filter = new Filter();
		Playfair playfair = new Playfair();
		String alphabet = "A B C D E F G H I J K L M N O P Q R S T U V W X Y Z";
		alphabet = filter.format(alphabet);
		char[] chars = alphabet.toCharArray();
		char[] randKey = shuffler.generateRandomKey(chars);
		System.out.print("Randomly generated key: ");
		System.out.print(randKey);
		String key = new String(randKey);
		playfair.setKey(key);
		playfair.generateKey();
		playfair.generateMatrix();
		char[][] matrix = playfair.getMatrix();
		shuffler.setMatrix(matrix);
		shuffler.setParent(playfair.getKey());
		System.out.println("\nKey Matrix: \n");
		shuffler.printMatrix();
	}
public static void testShuffler ( ) { Shuffler shuffler = new Shuffler ( ) ; Filter filter = new Filter ( ) ; Playfair playfair = new Playfair ( ) ; String alphabet = "A B C D E F G H I J K L M N O P Q R S T U V W X Y Z" ; alphabet = filter . format ( alphabet ) ; char [ ] chars = alphabet . toCharArray ( ) ; char [ ] randKey = shuffler . generateRandomKey ( chars ) ; System . out . print ( "Randomly generated key: " ) ; System . out . print ( randKey ) ; String key = new String ( randKey ) ; playfair . setKey ( key ) ; playfair . generateKey ( ) ; playfair . generateMatrix ( ) ; char [ ] [ ] matrix = playfair . getMatrix ( ) ; shuffler . setMatrix ( matrix ) ; shuffler . setParent ( playfair . getKey ( ) ) ; System . out . println ( "\nKey Matrix: \n" ) ; shuffler . printMatrix ( ) ; }
quick test to see if shuffler is working correctly
quick test to see if shuffler is working correctly
//generating a random key //setting the key and generating the key + matrix in playfair class //getting the matrix generated in playfair class and setting shuffler matrix //testing shuffling methods //shuffler.shuffleKey(shuffler.getParent()); //System.out.println("\n"); //shuffler.printMatrix(); //shuffler.swapRandomLetters(); //System.out.println("\n"); //shuffler.printMatrix(); //shuffler.swapRandomRows(); //System.out.println("\n"); //shuffler.printMatrix(); //shuffler.swapRandomCols(); //System.out.println("\n"); //shuffler.printMatrix(); //shuffler.flipAllRows(); //System.out.println("\n"); //shuffler.printMatrix(); //shuffler.flipAllCols(); //System.out.println("\n"); //shuffler.printMatrix(); //shuffler.reverseKey(); //System.out.println("\n"); //shuffler.printMatrix();