Files
LGram16 dd97ddec92 Restructure repository to include all source folders
Move git root from Client/ to src/ to track all source code:
- Client: Game client source (moved to Client/Client/)
- Server: Game server source
- GameTools: Development tools
- CryptoSource: Encryption utilities
- database: Database scripts
- Script: Game scripts
- rylCoder_16.02.2008_src: Legacy coder tools
- GMFont, Game: Additional resources

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-29 20:17:20 +09:00

59 lines
1.5 KiB
C++

#ifndef _CXOR_CRYPT_H_
#define _CXOR_CRYPT_H_
#pragma once
#include <Pattern/Singleton.h>
class CXORCrypt : public CSingleton<CXORCrypt>
{
public:
enum
{
PAGE_VERSION = 0,
BIT_COUNT = 40,
CODE_PAGE = 10,
};
private:
static const unsigned char BitFields[][CODE_PAGE][BIT_COUNT];
unsigned char m_CodePage[CODE_PAGE * 10];
unsigned long m_CodePageCount;
void InitCodePage(void);
void XORF(char *Start_In, int Length_In, unsigned short PageVer, unsigned char PageNum1, unsigned char PageNum2);
void XORB(char *Start_In, int Length_In, unsigned short PageVer, unsigned char PageNum1, unsigned char PageNum2);
// To make Singleton Class.
CXORCrypt();
static CXORCrypt ms_this;
public:
~CXORCrypt();
// interface of encoder, decoder
unsigned long GetCodePage(void);
unsigned long GetCodePage(unsigned short PageVer_In);
inline unsigned short GetPageVer(unsigned long CodePage_In);
bool EncodePacket(char *Start_In, int Length_In, unsigned long CodePage_In);
bool DecodePacket(char *Start_In, int Length_In, unsigned long CodePage_In);
void EncodeHeader(char *Start_In, int HeaderLen_In, unsigned short PageVer_In, unsigned char PageNum_In);
void DecodeHeader(char *Start_In, int HeaderLen_In, unsigned short PageVer_In, unsigned char PageNum_In);
};
inline unsigned short CXORCrypt::GetPageVer(unsigned long CodePage_In)
{
return (unsigned short)(((CodePage_In & 0xffff0000) >> 16) & 0x0000ffff);
}
#endif