SA-MP/saco/archive/TinyEncrypt.h

40 lines
698 B
C
Raw Normal View History

2023-11-08 20:29:53 +08:00
#pragma once
#include <windows.h>
#define TEA_KEY_SIZE 16
class CTinyEncrypt
{
private:
static DWORD ms_dwRounds;
static DWORD ms_dwInitDelta;
static DWORD ms_dwInitSum;
static BOOL ms_bInitDone;
DWORD m_pdwKey[TEA_KEY_SIZE/sizeof(DWORD)];
2024-05-23 23:22:12 +08:00
#ifdef ARCTOOL
void EncryptBlock(DWORD &dwV0, DWORD &dwV1);
#endif
2023-11-08 20:29:53 +08:00
void DecryptBlock(DWORD &dwV0, DWORD &dwV1);
public:
CTinyEncrypt(void);
~CTinyEncrypt(void);
void SetKey(BYTE* pbKey, BYTE bytXORKey);
2024-05-23 23:22:12 +08:00
#ifdef ARCTOOL
void LoadKey(PCHAR szFileName);
void WriteKey(PCHAR szFileName);
void WriteCHeaderFile(PCHAR szFileName);
void EncryptData(DWORD dwLength, BYTE* pbData);
#endif
2023-11-08 20:29:53 +08:00
void DecryptData(DWORD dwLength, BYTE* pbData);
};