jiami.java

来自「整体思路 用createkey.java 文件来产生秘钥」· Java 代码 · 共 78 行

JAVA
78
字号
import java.io.*;import java.math.*;public class jiami{	int b;	char ch[]=new char[8];	byte tom[]=new byte[16];	BigInteger n;	BigInteger e;	BigInteger d;	File f;	File ff;	jiami(BigInteger n,BigInteger e,BigInteger d,File f,File ff)	{		this.n=n;		this.e=e;		this.d=d;		this.f=f;		this.ff=ff;		try{			FileInputStream in=new FileInputStream(f);			FileOutputStream out=new FileOutputStream(ff);						int i=0;			while((b=in.read(tom,1,15))!=-1)			{								BigInteger m;				if(b<15)				{					for(int j=0;j<16;j++)						System.out.print(tom[j]);					System.out.println();										byte tt[]=new byte[b+1];					for(int j=0;j<b+1;j++)						tt[j]=tom[j];					m=new BigInteger(tt);				}				else					m=new BigInteger(tom);								BigInteger c=m.modPow(e,n);				BigInteger mm=c.modPow(d,n);								byte tom2[]=new byte[16];				tom2=c.toByteArray();								if(tom2.length==17)					out.write(tom2,1,16);				else if(tom2.length==16)					out.write(tom2,0,16);				else if(tom2.length<16)				{					byte temp[]=new byte[16];					for(int j=0;j<16;j++)						temp[j]=0;					out.write(temp, 0, 16-tom2.length);					out.write(tom2, 0, tom2.length);				}				i++;												for(int j=0;j<16;j++)					tom[j]=0;			}			out.close();			in.close();				}		catch(IOException te)		{			System.out.println("File read Error"+te);		}			}}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?