你好,欢迎来到电脑编程技巧与维护杂志社! 杂志社简介广告服务读者反馈编程社区  
合订本订阅
 
 
您的位置:杂志经典 / 计算机安全与维护
IDEA对称密码算法剖析(十三)
 

 }

 

      cipher_idea(input,output,Z);   // 64位明文加密

 

      for (y=0;y<x;y++) 

      {

         if (noisy) if (count++%256==0) printf(".");  //每加密64次明文输出一次.

         write_word16_to_file(output[y],out); //密文输出到OUT文件流中

      }

   }

}

//  对密文解密,  与加密过程相似, 不同的地方给出注释

void decipher_file(FILE *in,FILE *out,word16 *key)

{

   word16 input[4],output[4];

   int x,y;

   IDEAkey Z,DK;

   int count=0;

   long length=0;

 

   en_key_idea(key,Z);  // 生成52个子密钥

   de_key_idea(Z,DK);  //  通过加密密钥生成解密密钥

 

   end_of_file=0;

 

   fread(&length,sizeof(long),1,in);  //读出文件长度

 

 

   while (!end_of_file)

   {

      x=0;

      while (x<4)

      {

     input[x]=read_word16_from_file(in);

     if (end_of_file)

        break;

     x++;

  推荐精品文章

·2024年2月目录 
·2024年1月目录
·2023年12月目录
·2023年11月目录
·2023年10月目录
·2023年9月目录 
·2023年8月目录 
·2023年7月目录
·2023年6月目录 
·2023年5月目录
·2023年4月目录 
·2023年3月目录 
·2023年2月目录 
·2023年1月目录 

  联系方式
TEL:010-82561037
Fax: 010-82561614
QQ: 100164630
Mail:gaojian@comprg.com.cn

  友情链接
 
Copyright 2001-2010, www.comprg.com.cn, All Rights Reserved
京ICP备14022230号-1,电话/传真:010-82561037 82561614 ,Mail:gaojian@comprg.com.cn
地址:北京市海淀区远大路20号宝蓝大厦E座704,邮编:100089