資源簡介
DES算法是這樣工作的:如Mode為加密,則用Key 去把數(shù)據(jù)Data進行加密, 生成Data的密碼形式(64位)作為DES的輸出結(jié)果;如Mode為解密,則用Key去把密碼形式的數(shù)據(jù)Data解密,還原為Data的明碼形式(64位)作為DES的輸出結(jié)果。在通信網(wǎng)絡(luò)的兩端,雙方約定一致的Key,在通信的源點用Key對核心數(shù)據(jù)進行DES加密,然后以密碼形式在公共通信網(wǎng)(如電話網(wǎng))中傳輸?shù)酵ㄐ啪W(wǎng)絡(luò)的終點,數(shù)據(jù)到達目的地后,用同樣的Key對密碼數(shù)據(jù)進行解密,便再現(xiàn)了明碼形式的核心數(shù)據(jù)。這樣,便保證了核心數(shù)據(jù)(如PIN、MAC等)在公共通信網(wǎng)中傳輸?shù)陌踩院涂煽啃浴?
通過定期在通信網(wǎng)絡(luò)的源端和目的端同時改用新的Key,便能更進一步提高數(shù)據(jù)的保密性,這正是現(xiàn)在金融交易網(wǎng)絡(luò)的流行做法。
下面是DES原理及實現(xiàn)步驟,以及VC++關(guān)于DES加密解密的詳細源程序

代碼片段和文件信息
#include?
#include?“yxyDES.h“
void?main()
{
yxyDES*?my_des?=?new?yxyDES();
string?test_string?=?“test?des?plaintext!“;
printf(“firstwe?use?the?des:\n“);
//initialize?key
my_des->InitializeKey(“12345678“false);
printf(“key?is?:?12345678?\n“);
//use?des?to?encrypt
my_des->EncryptAnyLength(test_stringfalse);
printf(“set?plaintext?:?%s?\n“test_string.c_str());
//get?the?ciphertext
test_string?=?my_des->GetCiphertextAnyLength();
printf(“after?encrypt?:?%s?\n“test_string.c_str());
//use?des?to?decrypt
printf(“nowdecrypting...\n“);
my_des->DecryptAnyLength(test_stringfalse);
test_string?=?my_des->GetPlaintextAnyLength();
printf(“after?decrypt?:?%s?\n“test_string.c_str());
//use?3des
printf(“\n\nnowlet?us?use?the?3des:\n“);
printf(“before?encrypttest_string?is?:?%s\n“test_string.c_str());
//initialize?the?first?key
my_des->InitializeKey(“12345678“false);
printf(“the?first?key?is?:?12345678?\n“);
//initialize?the?second?key
my_des->InitializeKey(“87654321“true);
printf(“the?second?key?is?:?87654321?\n“);
//use?3des?to?encrypt
my_des->TripleEncryptAnyLength(test_string);
//get?the?ciphertext
test_string?=?my_des->GetCiphertextAnyLength();
printf(“after?encrypt?:?%s?\n“test_string.c_str());
//use?the?3des?to?decrypt
printf(“now(3des)decrypting...\n“);
my_des->TripleDecryptAnyLength(test_string);
test_string?=?my_des->GetPlaintextAnyLength();
printf(“after?(3des)decrypt?:?%s?\n“test_string.c_str());
getchar();
}
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件?????120027??2011-05-22?12:27??信息安全DES編程\DES+算法的介紹和實現(xiàn)(上).pdf
?????文件?????103696??2011-05-22?12:28??信息安全DES編程\DES+算法的介紹和實現(xiàn)(下).pdf
?????文件?????161792??2011-05-26?12:48??信息安全DES編程\des原理與實現(xiàn)步驟.doc
?????文件???????1531??2007-06-13?01:20??信息安全DES編程\VC++關(guān)于DES加密解密的詳細源程序\vc_3des\test_main.cpp
?????文件???????4420??2007-06-13?00:54??信息安全DES編程\VC++關(guān)于DES加密解密的詳細源程序\vc_3des\vc_3des.dsp
?????文件????????537??2007-06-13?00:21??信息安全DES編程\VC++關(guān)于DES加密解密的詳細源程序\vc_3des\vc_3des.dsw
?????文件????7302144??2007-12-29?12:00??信息安全DES編程\VC++關(guān)于DES加密解密的詳細源程序\vc_3des\vc_3des.ncb
?????文件??????49664??2007-06-13?01:23??信息安全DES編程\VC++關(guān)于DES加密解密的詳細源程序\vc_3des\vc_3des.opt
?????文件???????1469??2007-06-13?01:20??信息安全DES編程\VC++關(guān)于DES加密解密的詳細源程序\vc_3des\vc_3des.plg
?????文件????????878??2007-12-29?12:00??信息安全DES編程\VC++關(guān)于DES加密解密的詳細源程序\vc_3des\vc_3des.sln
????..A..H.??????8192??2007-12-29?12:00??信息安全DES編程\VC++關(guān)于DES加密解密的詳細源程序\vc_3des\vc_3des.suo
?????文件???????5631??2007-12-29?12:00??信息安全DES編程\VC++關(guān)于DES加密解密的詳細源程序\vc_3des\vc_3des.vcproj
?????文件???????1427??2007-12-29?12:00??信息安全DES編程\VC++關(guān)于DES加密解密的詳細源程序\vc_3des\vc_3des.vcproj.A31CF74D38B24B5.Administrator.user
?????文件??????28061??2007-06-13?00:54??信息安全DES編程\VC++關(guān)于DES加密解密的詳細源程序\vc_3des\yxyDES.cpp
?????文件??????11339??2007-06-13?00:54??信息安全DES編程\VC++關(guān)于DES加密解密的詳細源程序\vc_3des\yxyDES.h
?????文件??????26472??2011-05-22?12:24??信息安全DES編程\[.[.文本DES加密.rar
?????文件?????113152??2011-05-22?22:27??信息安全DES編程\實用密碼學(xué):DES代碼.doc
?????目錄??????????0??2011-05-26?12:48??信息安全DES編程\VC++關(guān)于DES加密解密的詳細源程序\vc_3des\Debug
?????目錄??????????0??2011-05-26?12:48??信息安全DES編程\VC++關(guān)于DES加密解密的詳細源程序\vc_3des
?????目錄??????????0??2011-05-26?12:48??信息安全DES編程\VC++關(guān)于DES加密解密的詳細源程序
?????目錄??????????0??2011-05-26?12:49??信息安全DES編程
-----------?---------??----------?-----??----
??????????????7940432????????????????????21
- 上一篇:九宮格程序c++人工智能
- 下一篇:RSA加密算法用MFC實現(xiàn)
評論
共有 條評論