自己写的明文加密程序的源代码(支持32M的文本文件)

这篇博客分享了一个能够处理32M文本文件的自编明文加密程序的源代码,适用于文件保护和数据安全。通过CMD命令行操作,程序实现了输入文件的加密,并生成安全的输出文件。
摘要由CSDN通过智能技术生成



#include <stdio.h>
#include <stdlib.h>
#include <string.h> 
#include <io.h>

//定义BSIZE为32*1M 
#define BSIZE (32*1024*1024)
char buf[BSIZE];

int convertchar(char *buf, int bufsize);
int resumechar(char *buf, int bufsize);
int write_file(const char *fout, const char *buf, int bufsize);
int read_file(const char *fin, char *buf, int bufsize, int flag);
int p_buf(const char *buf, int n);
char *input_fname(char * in_fn, int fn_size);
void p_help(void);

int main(int argc, char *argv[])
{

  char buf_sw[256], in_fn[256];
  int read_n = 0;
  p_help();
  while(printf("\ninput cmd>"),gets(buf_sw))
  {

      switch(buf_sw[0])
      {
          case 'c':
                    printf("please input file(be converted) path...\n");
                    read_n = read_file(input_fname(in_fn, 256), buf, BSIZE, 0);
                    if(read_n < 0)
                    {
                        printf("read fail!\n");
                        break;
                    }
                    printf("begin convert file...\n");
                    //简单的 转换,加密文档 
                    if(convertchar(buf, read_n))
                    {
                        printf("convert fail!\n");
                        break;
                    }
                    printf("convert file ok!\n");
                    printf("save 
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值