亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? playfair.java

?? playfair加密算法、解密算法的實現示例
?? JAVA
字號:
import java.io.*;
import java.util.*;

public class Playfair {
	private String srcFilePath;
	private String prnPath;
	private Character[][] table= new Character[5][5];
	private Character lastChar;
	private RandomAccessFile of;
	
	public Playfair(String filePath,String parentPath,String key){
		this.srcFilePath = filePath;
		this.prnPath = parentPath;
		key = key+"abcdefghijklmnopqrstuvwxyz";
		
		Set set = new LinkedHashSet();
		for(int i=0;i<key.length();i++)
			set.add(key.charAt(i));

		Iterator iterator = set.iterator();
		for(int i=0;i<5;i++){
			for(int j=0;j<5;j++){
				table[i][j]= (Character)iterator.next();
				System.out.print(" "+table[i][j]);
			}
			if(i<4)
				System.out.print("\n");
		}

		lastChar = (Character)iterator.next();
		System.out.print("/"+lastChar+"\n");
	}// Playfair constructor
	
	public void cipher(){
		try{
        	File sourceFile = new File(srcFilePath);	
        	File outFile = new File(prnPath+"\\Playfair encryption.txt");
			outFile.createNewFile();
			
        	RandomAccessFile sf = new RandomAccessFile(sourceFile,"r");
    		of = new RandomAccessFile(outFile,"rw");	
		    		
    		Byte inChar;	// one byte read in
    		int intV;		//intValue of inChar
    		int[] couple={0,0};	//a couple of letters
    		int p=0;  // pointer of couple[2]
			while(sf.getFilePointer()<sourceFile.length()){    		
				inChar = sf.readByte();
				intV = inChar.intValue();
				
				//divide input strings into couples of letters
				if(p==0||p==1)
				{
					if(intV>=65&&intV<=90)
						couple[p++] = intV+32;
					else if(intV>=97&&intV<=122)
						couple[p++] = intV;
					else
						of.writeByte(intV);	//inChar is not a letter
				}
				
				//write out a couple of letters
				if(p==2){
					if(couple[0]==couple[1])
					{
						substitition(couple[0], lastChar);
						couple[0]=couple[1];
						p=1;
					}
					else
					{
						substitition(couple[0],couple[1]);
						p=0;
					}					
				}
			}
			if(p==1)
				substitition(couple[0], lastChar);
    		sf.close();
    		of.close();			
		}//end try
		catch(FileNotFoundException ex){
			System.out.println("Err when accessing source file");
		}
		catch(IOException ex){
			System.out.println("Err when reading in");
		}
	}// cipher()
	
	public void substitition(int c0, int c1){
		int c0x=4,c0y=4,c1x=4,c1y=4;
		//find c0 in the table, and get the index
		if(c0!=lastChar){
			for(int i=0;i<5;i++)
				for(int j=0;j<5;j++)
				{
					if(c0==table[i][j])
						{
							c0x=i;
							c0y=j;
						}
				}
		}
		
		//find c1 in the table, and get the index
		if(c1!=lastChar){
			for(int i=0;i<5;i++)
				for(int j=0;j<5;j++)
				{
					if(c1==table[i][j])
						{
							c1x=i;
							c1y=j;
						}
				}
		}

		if(c0x==c1x){	//c0,c1 are in the same row			
			c0y = (c0y+1)%5;
			c1y = (c1y+1)%5;
			try{
				this.of.writeByte(table[c0x][c0y]);
				this.of.writeByte(table[c1x][c1y]);
			}
			catch(IOException ex){
				System.out.println("Err when writing out");
			}
		}
		
		else if(c0y==c1y){	//c0,c1 are in the same column			
			c0x = (c0x+1)%5;
			c1x = (c1x+1)%5;
			try{
				this.of.writeByte(table[c0x][c0y]);
				this.of.writeByte(table[c1x][c1y]);
			}
			catch(IOException ex){
				System.out.println("Err when writing out");
			}
		}
			
		else{
			try{
				this.of.writeByte(table[c0x][c1y]);
				this.of.writeByte(table[c1x][c0y]);
			}
			catch(IOException ex){
				System.out.println("Err when writing out");
			}
		}
	}// substitution(int c0, int c1)
	
	public void decipher(){
		try{
        	File sourceFile = new File(srcFilePath);	
        	File outFile = new File(prnPath+"\\Playfair decryption.txt");
			outFile.createNewFile();
			
        	RandomAccessFile sf = new RandomAccessFile(sourceFile,"r");
    		of = new RandomAccessFile(outFile,"rw");	
		    		
    		Byte inChar;	// one byte read in
    		int intV;		//intValue of inChar
    		int[] couple={0,0};	//a couple of letters
    		int p=0;  // pointer of couple[2]
			while(sf.getFilePointer()<sourceFile.length()){    		
				inChar = sf.readByte();
				intV = inChar.intValue();
				
				//divide input strings into couples of letters
				if(p==0||p==1)
				{
					if(intV>=65&&intV<=90)
						couple[p++] = intV+32;
					else if(intV>=97&&intV<=122)
						couple[p++] = intV;
					else
						of.writeByte(intV);	//inChar is not a letter
				}
				
				//write out a couple of letters
				if(p==2){
					if(couple[0]==couple[1])
					{
						resub(couple[0], lastChar);
						couple[0]=couple[1];
						p=1;
					}
					else
					{
						resub(couple[0],couple[1]);
						p=0;
					}					
				}
			}
			if(p==1)
				resub(couple[0], lastChar);
    		sf.close();
    		of.close();			
		}//end try
		catch(FileNotFoundException ex){
			System.out.println("Err when accessing source file");
		}
		catch(IOException ex){
			System.out.println("Err when reading in");
		}
	}// decipher()
	
	public void resub(int c0, int c1){
		int c0x=4,c0y=4,c1x=4,c1y=4;
		//find c0 in the table, and get the index
		if(c0!=lastChar){
			for(int i=0;i<5;i++)
				for(int j=0;j<5;j++)
				{
					if(c0==table[i][j])
						{
							c0x=i;
							c0y=j;
						}
				}
		}
		
		//find c1 in the table, and get the index
		if(c1!=lastChar){
			for(int i=0;i<5;i++)
				for(int j=0;j<5;j++)
				{
					if(c1==table[i][j])
						{
							c1x=i;
							c1y=j;
						}
				}
		}

		if(c0x==c1x){	//c0,c1 are in the same row			
			c0y = (c0y-1)%5;
			c1y = (c1y-1)%5;
			try{
				this.of.writeByte(table[c0x][c0y]);
				this.of.writeByte(table[c1x][c1y]);
			}
			catch(IOException ex){
				System.out.println("Err when writing out");
			}
		}
		
		else if(c0y==c1y){	//c0,c1 are in the same column			
			c0x = (c0x-1)%5;
			c1x = (c1x-1)%5;
			try{
				this.of.writeByte(table[c0x][c0y]);
				this.of.writeByte(table[c1x][c1y]);
			}
			catch(IOException ex){
				System.out.println("Err when writing out");
			}
		}
			
		else{
			try{
				this.of.writeByte(table[c0x][c1y]);
				this.of.writeByte(table[c1x][c0y]);
			}
			catch(IOException ex){
				System.out.println("Err when writing out");
			}
		}
	}//resub(int c0,int c1)
}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产成人亚洲精品青草天美| 26uuu亚洲综合色欧美 | 日韩视频中午一区| 日本一区二区免费在线观看视频| 亚洲国产精品视频| 成人高清视频在线| 日韩欧美亚洲一区二区| 亚洲国产人成综合网站| 成人免费视频一区| 欧美精品一区二区三区一线天视频 | 亚洲欧美在线高清| 国产综合久久久久影院| 91精品视频网| 亚洲一区国产视频| 色一区在线观看| 国产精品美女久久久久aⅴ国产馆 国产精品美女久久久久av爽李琼 国产精品美女久久久久高潮 | 精久久久久久久久久久| 91一区二区在线| 国产精品美女久久久久久| 久久97超碰国产精品超碰| 欧美日韩亚洲综合在线| 一区二区欧美国产| 91啪九色porn原创视频在线观看| 国产视频一区二区在线| 国产一区二区视频在线| 欧美大黄免费观看| 久久精品国产77777蜜臀| 欧美日韩国产经典色站一区二区三区| 国产精品久久国产精麻豆99网站| 国产成人av福利| 国产婷婷一区二区| 国产成人免费视频一区| 久久蜜臀精品av| 国产精品一区二区在线观看网站| 久久综合色综合88| 国产精品夜夜嗨| 久久久久成人黄色影片| 国产成人免费在线观看不卡| 欧美激情一区二区三区不卡 | 美女视频黄免费的久久| 69精品人人人人| 男人的天堂久久精品| 日韩欧美在线网站| 国产精品资源网站| 国产欧美精品一区二区色综合朱莉| 国产乱码一区二区三区| 中文乱码免费一区二区| 色诱视频网站一区| 香蕉成人伊视频在线观看| 欧美一区国产二区| 激情偷乱视频一区二区三区| 国产女主播一区| 91在线观看成人| 日韩精品欧美精品| 久久欧美一区二区| 91亚洲精华国产精华精华液| 亚洲成人av在线电影| 精品精品国产高清一毛片一天堂| 国产福利一区二区| 亚洲男帅同性gay1069| 欧美一级专区免费大片| 国产999精品久久久久久绿帽| 最新高清无码专区| 日韩一区二区三区在线观看| 国产69精品久久777的优势| 亚洲一区在线观看免费| 亚洲精品一区二区三区香蕉| 色哟哟一区二区在线观看| 日本不卡的三区四区五区| 国产精品乱人伦一区二区| 欧美日韩色综合| 国产成人av电影在线| 亚洲一二三四区不卡| 国产亚洲精品中文字幕| 欧美性感一区二区三区| 国产激情偷乱视频一区二区三区 | 色综合天天在线| 蜜乳av一区二区三区| 中文字幕在线不卡一区| 欧美大片在线观看| 色婷婷av一区| 国产宾馆实践打屁股91| 亚洲超碰97人人做人人爱| 国产日韩精品一区二区浪潮av| 在线观看免费成人| 成人免费三级在线| 美腿丝袜一区二区三区| 亚洲精品日日夜夜| 国产欧美日韩三级| 日韩午夜激情视频| 91精品1区2区| 成人黄页毛片网站| 久久成人综合网| 日韩av一区二区在线影视| 亚洲精品伦理在线| 欧美国产精品v| 久久久久久亚洲综合| 欧美一区二区三区四区在线观看| 色婷婷av一区| 91蝌蚪porny九色| 成人在线视频首页| 国产乱码字幕精品高清av| 男女男精品视频网| 日韩av电影免费观看高清完整版 | 久久午夜国产精品| 日韩午夜激情视频| 91麻豆精品91久久久久久清纯| 日韩欧美中文字幕精品| 555夜色666亚洲国产免| 91黄色免费观看| 欧美视频日韩视频在线观看| 欧美亚洲综合另类| 91蝌蚪国产九色| 色婷婷综合久久久中文一区二区| 成人黄色小视频| 成人黄色片在线观看| 不卡的av电影| 97国产一区二区| 色诱视频网站一区| 欧美丝袜丝交足nylons图片| 欧美性视频一区二区三区| 欧美日免费三级在线| 欧美日韩精品欧美日韩精品一| 欧美日本一区二区在线观看| 欧美精品久久一区| 精品日韩在线一区| 久久综合资源网| 中文字幕一区在线观看| 亚洲激情图片一区| 日韩国产欧美在线播放| 精品亚洲porn| av电影在线观看不卡| 91搞黄在线观看| 欧美一区二区视频在线观看2022| 日韩午夜电影av| 国产欧美一区二区精品性色| 成人欧美一区二区三区白人 | 欧美韩国日本一区| 亚洲人成网站精品片在线观看| 艳妇臀荡乳欲伦亚洲一区| 色综合中文字幕国产| 99vv1com这只有精品| 欧美在线观看一二区| 欧美一卡2卡3卡4卡| 日本一区二区综合亚洲| 亚洲一区二区综合| 激情五月播播久久久精品| 国产91精品免费| 欧美区一区二区三区| 久久久www成人免费毛片麻豆| 亚洲精品国产成人久久av盗摄| 日韩影视精彩在线| 国产黄色成人av| 欧美色综合久久| 久久综合精品国产一区二区三区| 综合在线观看色| 麻豆91小视频| 日本韩国精品在线| 久久影音资源网| 亚洲成a人片综合在线| 国产高清不卡一区| 欧美精品aⅴ在线视频| 亚洲国产精品精华液2区45| 午夜电影一区二区| www.性欧美| 欧美tickling网站挠脚心| 亚洲中国最大av网站| 国产福利精品一区二区| 日韩丝袜情趣美女图片| 亚洲视频电影在线| 国产美女主播视频一区| 欧美日本高清视频在线观看| 国产精品天美传媒| 久久疯狂做爰流白浆xx| 欧美日本免费一区二区三区| 日韩一区在线免费观看| 国产精品1区二区.| 日韩欧美自拍偷拍| 亚洲成人免费视| 99久精品国产| 中文字幕av一区二区三区免费看 | 豆国产96在线|亚洲| 日韩午夜av一区| 视频一区二区不卡| 欧美在线观看视频一区二区三区| 国产精品全国免费观看高清| 久久99国产精品久久| 日韩三级视频在线看| 亚洲国产乱码最新视频| 色综合网站在线| 综合自拍亚洲综合图不卡区| 国产成人aaaa| 国产日韩av一区| 国产+成+人+亚洲欧洲自线| 26uuu亚洲综合色欧美| 国产在线一区二区| 精品久久久久一区二区国产| 毛片av中文字幕一区二区| 欧美一级xxx| 久久99久久久欧美国产|