vc++实现des加密和解密


用vc++6.0实现des的加密和解密功能
资源截图
代码片段和文件信息
#include 
#include “yxyDES.h“

void main()
{
yxyDES* my_des = new yxyDES();
string test_string = “test des plaintext!“;
printf(“firstwe use the des:
“);
//initialize key
my_des->InitializeKey(“12345678“false);
printf(“key is : 12345678 
“);
//use des to encrypt
my_des->EncryptAnyLength(test_stringfalse);
printf(“set plaintext : %s 
“test_string.c_str());
//get the ciphertext
test_string = my_des->GetCiphertextAnyLength();
printf(“after encrypt : %s 
“test_string.c_str());
//use des to decrypt
printf(“nowdecrypting...
“);
my_des->DecryptAnyLength(test_stringfalse);
test_string = my_des->GetPlaintextAnyLength();
printf(“after decrypt : %s 
“test_string.c_str());

//use 3des
printf(“

nowlet us use the 3des:
“);
printf(“before encrypttest_string is : %s
“test_string.c_str());
//initialize the first key
my_des->InitializeKey(“12345678“false);
printf(“the first key is : 12345678 
“);
//initialize the second key
my_des->InitializeKey(“87654321“true);
printf(“the second key is : 87654321 
“);
//use 3des to encrypt
my_des->TripleEncryptAnyLength(test_string);
//get the ciphertext
test_string = my_des->GetCiphertextAnyLength();
printf(“after encrypt : %s 
“test_string.c_str());
//use the 3des to decrypt
printf(“now(3des)decrypting...
“);
my_des->TripleDecryptAnyLength(test_string);
test_string = my_des->GetPlaintextAnyLength();
printf(“after (3des)decrypt : %s 
“test_string.c_str());
getchar();
}

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件       1531  2007-06-13 01:20  vc_3des est_main.cpp

     文件       4420  2007-06-13 00:54  vc_3desvc_3des.dsp

     文件        537  2007-06-13 00:21  vc_3desvc_3des.dsw

     文件    7302144  2007-12-29 12:00  vc_3desvc_3des.ncb

     文件      49664  2007-06-13 01:23  vc_3desvc_3des.opt

     文件       1469  2007-06-13 01:20  vc_3desvc_3des.plg

     文件        878  2007-12-29 12:00  vc_3desvc_3des.sln

    ..A..H.      8192  2007-12-29 12:00  vc_3desvc_3des.suo

     文件       5631  2007-12-29 12:00  vc_3desvc_3des.vcproj

     文件       1427  2007-12-29 12:00  vc_3desvc_3des.vcproj.A31CF74D38B24B5.Administrator.user

     文件      28061  2007-06-13 00:54  vc_3desyxyDES.cpp

     文件      11339  2007-06-13 00:54  vc_3desyxyDES.h

     目录          0  2007-06-13 01:24  vc_3desDebug

     目录          0  2007-12-29 12:00  vc_3des

----------- ---------  ---------- -----  ----

              7415293                    14


版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容, 请发送邮件举报,一经查实,本站将立刻删除。

发表评论

评论列表(条)