DragonNest/Common/EtFileSystem/Crypt.cpp
Cussrro 47f7895977 Revert "修复编码问题"
This reverts commit 9e69c01767.
2024-12-21 10:04:04 +08:00

66 lines
No EOL
1.6 KiB
C++

#include "StdAfx.h"
#include <stdio.h>
#include "Singleton.h"
#include "Crypt.h"
//Chei
BYTE KEYS[] = { 0x52, 0x41, 0x4c, 0x55, 0x4b, 0x41, 0x54, 0x08, 0xc1, 0x6d, 0x1b, 0x7c, 0x81, 0x8f, 0x3b, 0xe5, 0xed, 0x27, 0xed, 0x7f, 0xf8, 0xae, 0x25, 0xea, 0xc3, 0x79, 0x9b, 0x5a, 0xb9, 0x20, 0x9c, 0x7c, 0x08, 0xdf, 0x55, 0x23, 0x3a, 0xb3, 0x86, 0xc5, 0xac, 0xef, 0x24, 0x5e, 0xad, 0x42, 0xe7, 0x31, 0xb7, 0x77, 0xf8, 0x03, 0x8b, 0x67, 0xdc, 0x91, 0xce, 0xe9, 0xcd, 0x1c, 0xf7, 0x6e, 0x3c, 0x1f, 0xc5, 0x88, 0x3c, 0xce, 0x75, 0x2e, 0x28, 0x4f, 0xbc, 0x16, 0x69, 0xb6, 0xab, 0x0f, 0x1e, 0x3d, 0xd0, 0x77, 0x7a, 0x00, 0x04, 0xab, 0x51, 0xdd, 0x62, 0x61, 0xe6, 0x8e, 0xc2, 0x7f, 0x1a, 0xe8, 0xb2, 0xb5, 0x53, 0x10, 0x24, 0xa8, 0x1c, 0x06, 0x72, 0x47, 0x6d, 0xc3, 0x53, 0x74, 0x1d, 0x60, 0x19, 0x8f, 0x5d, 0x49, 0x4b, 0x36, 0x3e, 0xe3, 0xbf, 0x19, 0x51, 0x3c, 0x0a, 0x01, 0xc8, 0xa3 };
//RALUKAT CRYPT!
Crypt::Crypt()
{
}
Crypt::~Crypt()
{
}
//Rutina de criptare
bool Crypt::Encrypt(BYTE* Data, int size)
{
for (int i = 1; i < size; i++)
{
Data[i] ^= Data[i - 1] ^ KEYS[i % 128];
}
return true;
}
//decriptare..
bool Crypt::Decrypt(BYTE* Data,int size)
{
for (int i = size - 1; i != 0; i += -1) //test???
{
Data[i] ^= Data[i - 1] ^ KEYS[i % 128];
}
return true;
}
/*
static public byte[] encrypt(byte[] data,int size)
{
for (int i = 1; i < size; i++)
{
data[i] ^= data[i - 1];
data[i] ^= Globals.CheiMagice[i % 128];
}
return data;
}
static public byte[] decrypt(byte[] data, int size)
{
//decrypt routines
for (int i = size-1; i != 0; i += -1)
{
data[i] ^= data[i - 1];
data[i] ^= Globals.CheiMagice[i % 128];
}
return data;
}
*/