Skip to content

Commit 95d3e4d

Browse files
author
Twlilght-Dream-Of-Magic
committed
Test and Fix Code * 2
1 parent ac39152 commit 95d3e4d

File tree

9 files changed

+13
-5
lines changed

9 files changed

+13
-5
lines changed
Binary file not shown.
Binary file not shown.

[Encrypt_Or_Decrypt_File]-Source-Code/Beta-Version3/Main_3_By_Twlilght_Yujiang.cpp

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ using namespace std;
4040
int RunEncryptFile(const char *E_SourceFileCharPath, char *E_KEY, char *E_KEY2, char *E_KEY3, char *E_KEY4, const char *E_TargetFileCharPath);
4141
int RunDecryptFile(const char *D_SourceFileCharPath, char *D_KEY, char *D_KEY2, char *D_KEY3, char *D_KEY4, const char *D_TargetFileCharPath);
4242

43-
//以下变量,应用到文件被加密时
43+
//以下变量,应用到文件被加密时
4444
//The following variables apply when the file is encrypted
4545
//***声明代码-开始 Declare the code - the beginning***
4646
string E_IF_PATH = ".\\WorkPath\\Encrypt\\InputFile\\", //加密之前,文件的路径 Before encrypting the path of the file
@@ -57,7 +57,7 @@ E_KEY3[256],
5757
E_KEY4[256];
5858
//***声明代码-结束 Declare the code - end***
5959

60-
//以下变量,应用到文件被解密时
60+
//以下变量,应用到文件被解密时
6161
//The following variables apply when the file is decrypted
6262
//***声明代码-开始 Declare the code - the beginning***
6363
string D_IF_PATH = ".\\WorkPath\\Decrypt\\InputFile\\", //解密之前,文件的路径 Before decrypting the path of the file
@@ -232,7 +232,7 @@ int main()
232232
SourceFileNameTempOutput << E_SourceFileExtendedName << endl;
233233
SourceFileNameTempOutput.close();
234234

235-
//加密密钥码是用户自己定义的,(长度小于256)。可以任意的给一个需要加密的文件添加一个或多个加密密钥码
235+
//加密密钥码是用户自己定义的,(长度小于256)。可以任意的给一个需要加密的文件添加一个或多个加密密钥码
236236
//Encryption key code is user-defined, (length less than 256). You can optionally add one or more encryption keys to the one files you want to encrypt
237237
E_KEY_LENTH_IS_INCORRECT:
238238
int E_KEY_CODE_MAX_LENGTH = 256;
@@ -244,6 +244,7 @@ int main()
244244
std::cin >> E_KEY;
245245
if(strlen(E_KEY) > E_KEY_CODE_MAX_LENGTH)
246246
{
247+
memset(E_KEY,NULL,sizeof(E_KEY)); //Reset This Variable The Value (NULL = 0)
247248
std :: cout << "加密密钥的长度,已经超过256位字符。 请重新输入所有加密密钥!" << endl;
248249
std :: cout << "Encryption key length, has more than 256 characters. Please re-enter the all encryption key!" << endl;
249250
system("pause");
@@ -257,6 +258,7 @@ int main()
257258
std::cin >> E_KEY2;
258259
if(strlen(E_KEY2) > E_KEY_CODE_MAX_LENGTH)
259260
{
261+
memset(E_KEY2,NULL,sizeof(E_KEY2)); //Reset This Variable The Value (NULL = 0)
260262
std :: cout << "加密密钥2的长度,已经超过256位字符。 请重新输入所有加密密钥!" << endl;
261263
std :: cout << "Encryption key2 length, has more than 256 characters. Please re-enter the all encryption key!" << endl;
262264
system("pause");
@@ -270,6 +272,7 @@ int main()
270272
std::cin >> E_KEY3;
271273
if(strlen(E_KEY3) > E_KEY_CODE_MAX_LENGTH)
272274
{
275+
memset(E_KEY3,NULL,sizeof(E_KEY3)); //Reset This Variable The Value (NULL = 0)
273276
std :: cout << "加密密钥3的长度,已经超过256位字符。 请重新输入所有加密密钥!" << endl;
274277
std :: cout << "Encryption key3 length, has more than 256 characters. Please re-enter the all encryption key!" << endl;
275278
system("pause");
@@ -283,6 +286,7 @@ int main()
283286
std::cin >> E_KEY4;
284287
if(strlen(E_KEY4) > E_KEY_CODE_MAX_LENGTH)
285288
{
289+
memset(E_KEY4,NULL,sizeof(E_KEY4)); //Reset This Variable The Value (NULL = 0)
286290
std :: cout << "加密密钥4的长度,已经超过256位字符。 请重新输入所有加密密钥!" << endl;
287291
std :: cout << "Encryption key4 length, has more than 256 characters. Please re-enter the all encryption key!" << endl;
288292
system("pause");
@@ -414,6 +418,7 @@ int main()
414418
std::cin >> D_KEY;
415419
if(strlen(D_KEY) > D_KEY_CODE_MAX_LENGTH)
416420
{
421+
memset(D_KEY,NULL,sizeof(D_KEY)); //Reset This Variable The Value (NULL = 0)
417422
std :: cout << "解密密钥的长度,已经超过256位字符。 请重新输入所有解密密钥!" << endl;
418423
std :: cout << "Decryption key length, has more than 256 characters. Please re-enter the all decryption key!" << endl;
419424
system("pause");
@@ -427,6 +432,7 @@ int main()
427432
std::cin >> D_KEY2;
428433
if(strlen(D_KEY2) > D_KEY_CODE_MAX_LENGTH)
429434
{
435+
memset(D_KEY2,NULL,sizeof(D_KEY2)); //Reset This Variable The Value (NULL = 0)
430436
std :: cout << "解密密钥2的长度,已经超过256位字符。 请重新输入所有解密密钥!" << endl;
431437
std :: cout << "Decryption key2 length, has more than 256 characters. Please re-enter the all decryption key!" << endl;
432438
system("pause");
@@ -440,6 +446,7 @@ int main()
440446
std::cin >> D_KEY3;
441447
if(strlen(D_KEY3) > D_KEY_CODE_MAX_LENGTH)
442448
{
449+
memset(D_KEY3,NULL,sizeof(D_KEY3)); //Reset This Variable The Value (NULL = 0)
443450
std :: cout << "解密密钥3的长度,已经超过256位字符。 请重新输入所有解密密钥!" << endl;
444451
std :: cout << "Decryption key3 length, has more than 256 characters. Please re-enter the all decryption key!" << endl;
445452
system("pause");
@@ -453,6 +460,7 @@ int main()
453460
std::cin >> D_KEY4;
454461
if(strlen(D_KEY4) > D_KEY_CODE_MAX_LENGTH)
455462
{
463+
memset(D_KEY4,NULL,sizeof(D_KEY4)); //Reset This Variable The Value (NULL = 0)
456464
std :: cout << "解密密钥4的长度,已经超过256位字符。 请重新输入所有解密密钥!" << endl;
457465
std :: cout << "Decryption key4 length, has more than 256 characters. Please re-enter the all decryption key!" << endl;
458466
system("pause");
@@ -517,7 +525,7 @@ int main()
517525
LoadSourceFileNameConfigure >> D_TargetFileExtendedName;
518526
//LoadSourceFileNameConfigure.getline(TFEN_Buffer,256,'\n'); //getline(char *,int,char) 表示该行字符达到256个或遇到换行就结束
519527
//D_TargetFileExtendedName = TFEN_Buffer;
520-
528+
521529
std::cout << "您已成功跳过此步骤" << endl;
522530
std::cout << "You have successfully skipped this step" << endl;
523531
}
@@ -532,7 +540,7 @@ int main()
532540
}
533541

534542
system("cls");
535-
543+
536544
std::cout << "\n";
537545
std::cout << "如果在当前文件夹下配置文件[.\\*.INI]不存在,程序就不会帮您自动恢复原来的文件名称。\n你需要重新输入文件名!" << endl;
538546
std::cout << "If the configuration file [.\\*.INI] does not exist in the current folder, the program will not automatically restore the original file name.\nYou need to re-enter the file name!" << endl;

0 commit comments

Comments
 (0)