1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90
|
// erwer.cpp : Defines the entry point for the application.
//
#include "stdio.h"
extern "C"
{
int wurschtsalod4(BYTE *seed, BYTE *arg_Ram52, BYTE *buff348);
int schweizerwurschtsalod3(BYTE *buff348, BYTE *arg_Rom, int arg_len);
int schweizerwurschtsalod4(BYTE *buff20, BYTE *buff348);
}
DWORD calVarCRC(BYTE * seed, BYTE * arg_Ram52, BYTE * arg_Rom, int arg_len)
{
BYTE buff348[348];
BYTE buff20[20];
int res = wurschtsalod4(seed, arg_Ram52, buff348);
res = schweizerwurschtsalod3(buff348, arg_Rom, arg_len - 4);
res = schweizerwurschtsalod4(buff20, buff348);
DWORD v = 0;
int k = 0;
do
{
BYTE idx = buff20[k++];
v |= (buff348[idx + 92] & 3) << (2 * k - 2);
}
while ( k < 16 );
DWORD crc = v;
char i = 0;
do
{
BYTE b = buff20[i + 16];
*((BYTE*)&crc + i++) ^= b;
}
while ( i < 4 );
return crc;
}
DWORD calFixCRC(BYTE * seed, BYTE * arg_Ram52, BYTE * arg_Rom, int arg_len)
{
BYTE buff348[348];
BYTE buff20[20];
int res = wurschtsalod4(seed, arg_Ram52, buff348);
res = schweizerwurschtsalod3(buff348, arg_Rom, arg_len - 4);
res = schweizerwurschtsalod4(buff20, buff348);
int j = 0;
DWORD v = 0;
do
{
BYTE idx = buff20[j++];
v |= ((buff348[idx + 92] & 0x18) >> 3) << (2 * j - 2);
}
while ( j < 16 );
char i = 0;
DWORD crc = v;
do
{
BYTE b = buff20[i + 16];
BYTE * pCrc = (BYTE *)&crc + -i++ + 3;
*pCrc ^= b;
}
while ( i < 4 );
return crc;
}
BYTE seed[] =
{
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
};
BYTE ram_rom[] =
{
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x0C,0xBE,0x2E,0x0D,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0xB8,0x12,0x10,0x27,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0xD4,0xE3,0x61,0x5A,0x4E,0x16,0x00,0x00,0x00,0x00,0xD5,0x8D,0x13,0xEE
};
|