这次,使用java来模拟现实playfair密码加密解密过程
import java.util.HashSet;
import java.util.Scanner;
public class Test1 {
public static char a[][] = new char[5][5];
public static String Encryptkey = "";
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner input = new Scanner(System.in);
System.out.println("Please input the key");
String key = input.nextLine();
System.out.println("Please input the clear key");
String clearkey = input.nextLine();
System.out.println("Please input the signture key");
String signture = input.nextLine();
System.out.println("Output the key matrix");
Keymatrix(key);
OutputMatrix();
System.out.println("Encrypt");
Encrypt(clearkey, signture.toUpperCase());
Dncrypt(Encryptkey);
}
private static void Dncrypt(String encryptkey2) {
// TODO Auto-generated method stub
String Dncryptkey = "";
int m=0, n=0, o=0, p=0;
for(int