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

📄 crypto.cpp

📁 使用XOR算法进行加解密
💻 CPP
字号:
#include <iostream.h>
#include <stdlib.h>
#include <fstream.h>

void Encrypt(char *file1)
   {
   	int crypto;
      char x;
      ifstream in_file;
      ofstream out_file;
      in_file.open(file1);
      if(in_file.fail())
      {
      	cout <<"\nError opening the file"<<file1
         <<"check that the file currently exists."<<endl;
         exit(1);
      }
      cout <<"Enter a name for the Encrypted file:";
      cin  >>file1;
      out_file.open(file1);
      in_file.get (x);
      if (in_file.eof())
      	return;
      while (x !=EOF)
      {
      crypto=x-0xFACA-0xFACA;
      out_file<<(char)crypto;
      in_file.get (x);
      if (in_file.eof())
      	break;
      }
      in_file.close();
      out_file.close();
      return;
	}

int main()
{
	const int MAXLENGHT=25;
   char file1[MAXLENGHT];
   ifstream in_file;
   cout <<"Enter the name of the file you wish to Encrypt:";
   cin >>file1;
   Encrypt(file1);
}

⌨️ 快捷键说明

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