⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ok-interface.cpp

📁 一个SCSI的编程
💻 CPP
字号:
#include<stdio.h>
#include"1-tst-interfacr.cpp"
#include<stdlib.h>
/*******************
This function is the interface of cryptograph algorithm.Its parameters as below:
0:name of the exe.
1st:the type(ie:1 is encrypt,2 is decrypt).
2ed:the type of algorithm(1:DES,2:3DES,3:RC4).
3st:the Input File(include whole path and filename).
4st:the Output File(include whole path and filename).
5st:iPatten.
6st:the key.
**********************/
int main(int argc,char *argv[])
{
	const char *KEY="CeressiaJasminea";
	/*It is a test.*/
//	unsigned char out[256];
	 
	clock_t start,end;
    double dElapsed;
	/*rockon by timw*/
	
  	 unsigned char uchBuf[256+3];
 /*the buffer to save data*/	 
	 FILE *fp1, *fp2;//*fd3,*fd4;

	 int iIsEncrypt,iPatten,iEncryptionAlgorithm =3;
	 iIsEncrypt=atoi(argv[1]);/*iIsEncrypt:encrypt or decrypt*/
	 iPatten=atoi(argv[5]);
	 iEncryptionAlgorithm =atoi(argv[2]);/*the type of algorithm*/
//	 memset(out,0,256);

//for(iIsEncrypt=1;iIsEncrypt<3;iIsEncrypt++)
//{
start = clock();

		
if(iIsEncrypt==1)
{

	memset(mima,0,sizeof(mima));/*mima:in rc4.cpp*/
	 fp1=fopen(argv[3],"rb");
	 fp2=fopen(argv[4],"wb");
//	 fd4=fopen("h:\\txt\\po.txt","wb");
//	  start = clock();
  		while(!feof(fp1))
		{	
			memset(uchBuf,0,256);
			memset(uchBuf+256,0,3);
//			memset(out,0,256);

    			readbyte=fread(uchBuf,sizeof(char),256,fp1);
			En_encryption(uchBuf,uchBuf,iPatten,argv[6],iEncryptionAlgorithm );
//			Encryption (seed1,readbyte,uchBuf);
			fwrite(uchBuf,sizeof(char),readbyte,fp2);
		}
		fclose(fp2);
		fclose(fp1);
}

else
{
	memset(mima,0,sizeof(mima));
//		fd3=fopen("h:\\txt\\c5.txt","rb");
//		fd4=fopen("h:\\txt\\p5.txt","wb");
	 fp1=fopen(argv[3],"rb");
	 fp2=fopen(argv[4],"wb");
		while(!feof(fp1))
		{	
			memset(uchBuf,0,256);
			memset(uchBuf+256,0,3);
//			memset(out,0,256);

    		readbyte=fread(uchBuf,sizeof(char),256,fp1);
			En_decryption(uchBuf,uchBuf,iPatten,argv[6],iEncryptionAlgorithm );
			fwrite(uchBuf,sizeof(char),readbyte,fp2);
		}
		fclose(fp1);
		fclose(fp2);

}		
//	end = clock();
//	dElapsed = ((double)(end-start))/CLOCKS_PER_SEC;

//	fclose(fp1);
//	fclose(fp2);
//	fclose(fd3);
//	fclose(fd4);
//	printf("%fOK!\n",dElapsed);
//}
	end = clock();
	dElapsed = ((double)(end-start))/CLOCKS_PER_SEC;
	printf("%fOK!\n",dElapsed);
	return 0;
}

⌨️ 快捷键说明

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