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

📄 zgh.cpp

📁 RSA加密的程序
💻 CPP
字号:
// zgh.cpp : Defines the entry point for the console application.
//

#include "stdio.h"
#include <string.h>

int main(int argc, char* argv[])
{
	FILE *fp,*Denstfp;
	char passwd[20];
	printf("please input passwd(4 char):");
	gets(passwd);

	fp=fopen("c:\\my.txt","rt");
	if(fp==NULL)
	{
		printf("Could not open file to read: d:\\zgh\\my.txt");
		return 0; 
	}
	Denstfp=fopen("c:\\my_pass.txt","wt");
	if(Denstfp==NULL)
	{
		fclose(fp);
		printf("Could not open file to write: d:\\zgh\\my_pass.txt");
		return 0;
	}
	while(!feof(fp))
	{
		char buff[20]="";
//..............
		fread(buff,sizeof(char),4,fp);
		buff[4]='\0';
		printf(buff);
		
		for(int i=0;i<strlen(buff);i++)
		{
			char ch=buff[i]^passwd[i];
			fflush(Denstfp);


			//fputc(ch,Denstfp);
			
			fprintf(Denstfp,"%c",ch);
		}
		//fwrite(buff,sizeof(char),4,Denstfp);
		
	}

	fclose(fp);
	fclose(Denstfp);
	printf("password success\n");
	return 0;
}

⌨️ 快捷键说明

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