Skip to content

Commit e2199df

Browse files
authored
Add files via upload
Update Debug 1.0.
1 parent 45a8f4c commit e2199df

35 files changed

+9457
-0
lines changed

cencrypt.cpp

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
/******************************
2+
* Author : YangRongBao
3+
* Date : 2021.4
4+
******************************/
5+
6+
#include "cencrypt.h"
7+
8+
CEncrypt::CEncrypt()
9+
{
10+
;
11+
}
12+
13+
CEncrypt::~CEncrypt()
14+
{
15+
;
16+
}
17+
18+
QByteArray CEncrypt::XOR(QByteArray byteArray, CEncryptModel encryptMode)
19+
{
20+
switch (encryptMode) {
21+
case Model_XOR:
22+
{
23+
QByteArray KEY = "8A3500F5BBD2A41";
24+
int keyIndex;
25+
for(int index = 0; index < byteArray.size(); ++index)
26+
{
27+
keyIndex = index % KEY.size();
28+
byteArray[index] = byteArray[index] ^ KEY[keyIndex];
29+
}
30+
break;
31+
}
32+
}
33+
return byteArray;
34+
}

cencrypt.h

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
/******************************
2+
* Author : YangRongBao
3+
* Date : 2021.4
4+
******************************/
5+
6+
#ifndef CENCRYPT_H
7+
#define CENCRYPT_H
8+
9+
#include <QChar>
10+
#include <QString>
11+
#include <QByteArray>
12+
13+
class CEncrypt
14+
{
15+
public:
16+
enum CEncryptError
17+
{
18+
Error_None, //无错误
19+
};
20+
enum CEncryptModel
21+
{
22+
Model_XOR, //异或加密解密
23+
};
24+
25+
CEncrypt();
26+
~CEncrypt();
27+
28+
QByteArray XOR(QByteArray, CEncryptModel);
29+
30+
protected:
31+
32+
private:
33+
34+
};
35+
36+
#endif // CENCRYPT_H

0 commit comments

Comments
 (0)