Aika Bin files encryption-decryption
Aika Online .bin encryption-decryption
Some of the Aika .bin files are encrypted. Here are cipher tables, asm functions and C/Delphi codes for encryption and decryption those files. You can examine them all and try to find something interesting.
P.S. if it necessary I can make a small app for automatization of (de)encryption process
ItemList%.bin
UI/PI.bin
EDI - length of decryption array
Algorithm
004058CE |> /8BC1 /MOV EAX,ECX
004058D0 |. |8A99 80B43401 |MOV BL,BYTE PTR DS:[ECX+134B480] ; byte from file
004058D6 |. |99 |CDQ
004058D7 |. |F7FF |IDIV EDI
004058D9 |. |8A92 54565E00 |MOV DL,BYTE PTR DS:[EDX+5E5654] ; load byte from table
004058DF |. |02D1 |ADD DL,CL ; add counter value
004058E1 |. |2ADA |SUB BL,DL
004058E3 |. |8899 80B43401 |MOV BYTE PTR DS:[ECX+134B480],BL ; write new byte to the buffer
004058E9 |. |41 |INC ECX
004058EA |. |81F9 00405600 |CMP ECX,00564000 ; cmp with file length
004058F0 |.^7C DC JL SHORT 004058CE
cipher table
Code:
BE C6 C0 CC C5 DB 20 B8 AE BD BA C6 AE 20 C0 CE
C4 DA B5 F9 20 B7 E7 C6 BE C0 D4 B4 CF B4 D9 2E
20 B7 EA B7 E7 20 B6 F6 B6 F3 2E 2E 2E 20 C0 B8
2E 2E 2E 20 C1 A4 B8 BB 20 C1 A4 B8 BB 20 B1 CD
C2 FA B4 D9 2E 20 B1 D7 B7 A1 B5 B5 20 C7 D8 BE
DF C7 CF B4 CF 20 BE EE C2 BF 20 BC F6 20 BE F8
C1 D2 2E 2E 2E 20
SkillData%d.bin
UI/Recipe.bin
UI/ReinforceW01.bin
UI/Reinforce2.bin
UI/Reinforce3.bin
UI/Easing.bin
UI/Siege01.bin
UI/Siege02.bin
UI/BW.bin
UI/MakeItems.bin
Algorithm same as above
cipher table
Code:
C0 CC B0 C5 20 C0 D0 C1 F6 20 B8 B6 BC BC BF E4
2E 20 C0 D0 C0 B8 B8 E9 20 B3 AA BB DB BB E7 B6
F7 B5 CB B4 CF B4 D9 2E 20 C1 A6 B9 DF 20 C0 FD
B4 EB 20 C0 D0 C1 F6 B8 BB B0 ED 20 C2 F8 C7 D1
20 BB E7 B6 F7 B5 EE B7 CE 20 BB E7 BC BC BF E4
2E 20 BE C6 BC CC C1 D2 3F 20 C1 C1 C0 BA BC BC
BB F3 B8 B8 B5 EC BD C3 B4 D9 2E
UI/curse.bin
00423468 |> /8A88 300EC101 /MOV CL,BYTE PTR DS:[EAX+1C10E30]
0042346E |. |40 |INC EAX
0042346F |. |F6D1 |NOT CL
00423471 |. |8888 2F0EC101 |MOV BYTE PTR DS:[EAX+1C10E2F],CL
00423477 |. |3D 00000100 |CMP EAX,10000
0042347C |.^72 EA JB SHORT 00423468
UI/MN.bin
00420052 |> /8A88 50D8AF01 /MOV CL,BYTE PTR DS:[EAX+1AFD850]
00420058 |. |2AC8 |SUB CL,AL
0042005A |. |8888 50D8AF01 |MOV BYTE PTR DS:[EAX+1AFD850],CL
00420060 |. |40 |INC EAX
00420061 |. |3D 00000400 |CMP EAX,40000
00420066 |.^7C EA JL SHORT 00420052
C, Delphi code example
v4 = 0;
do
{
dword_134B480[v4] -= (_BYTE)v4 + byte_5E5654[v4 % (signed int)(strlen(byte_5E5654) - 1)];
v4++;
}
decryption
for j:=0 to length(Buffer) - 1 do
buffer[j] := buffer[j] - (cipherTable[j mod cipherLength] + j);
encryption
for j:=0 to length(Buffer) - 1 do
buffer[j] := buffer[j] + (cipherTable[j mod cipherLength] + j);
© Dwar
SkillData.bin + ItemList.bin structure: [Only registered and activated users can see links. Click Here To Register...]
Re: Aika Bin files encryption-decryption
that's what i was asking!!! let me see with my University partners and clubs!!! I ? It!
Re: Aika Bin files encryption-decryption
Hi I just want write decrypt script for skills and items to get info about all possible items and write smth like that:
(files from aika GB version 121)
Code:
import os
out_file = open('B:\python\cipher\out.txt', 'wb')
class ByteFromFile:
def __init__(self, file_name):
self.file_name = file_name
self.file = open(self.file_name,'rb')
def GetFileByte(self,byte_num):
self.byte_num = byte_num
self.file.seek(self.byte_num)
return self.file.read(1)
def GetFileSize(self):
return os.path.getsize(self.file_name)
def __del__(self):
self.file.close()
Buffer = ByteFromFile('B:\python\cipher\SkillData8.bin')
Cipher = ByteFromFile('B:\python\cipher\cipher_table_skills.bin')
buffer_lenght = Buffer.GetFileSize()
cipher_lenght = Cipher.GetFileSize()
for J in range(0,buffer_lenght):
buffer_byte = ord(Buffer.GetFileByte(J)) #get byte form file
cipher_byte = ord(Cipher.GetFileByte(J % cipher_lenght)) #get byte from table
result = buffer_byte-cipher_byte #sub buff byte,table byte
if result < 0:
result = 255 + result
out_file.write(chr(result))
out_file.close()
But out file is not ok ( no description just looks more like 'show me all codes from 01 to ff' and do it in separate block of length similar to cipher table )
What is wrong with that? Can u give me any clue?
From where is CL in ADD DL,CL ? If I add number of current byte of file to cypher table byte and subtract it from buffer_byte I get just crazy instantly increasing values thats not make sense to me. What is that number?
Re: Aika Bin files encryption-decryption
Quote:
From where is CL in ADD DL,CL
from: INC ECX
Re: Aika Bin files encryption-decryption
INC ECX is incrementing every time when program is going thru buffer? So if buffer have 60000 bytes we have ECX from 0 to 60000? So we get sth like that - buffer = buffer_value - ( byte from cipher table ( ECX value mod length cipher_table) + ECX value )? So we get instantly increasing number from 0 to 60000 and get instantly greater buffer value and that is crazy nothing come from that ... can u show here an algoritm for that method of crypting , encryptying? Cause :
Code:
for j:=0 to length(Buffer) - 1 do
buffer[j] := buffer[j] - (cipherTable[j mod cipherLength] + j);
Is not giving proper results ... Ie:
lenght(buffer) = EA60
get B18E from buffer where on B18E place is C4 and in cipher table we get first value = BE so
buffer[B18E] = C4 - (BE + B18E) = wtf ...
1 Attachment(s)
Re: Aika Bin files encryption-decryption
If you don't understand simple algorithm, I can't help.
buffer - array of bytes;
Quote:
buffer = buffer_value - ( byte from cipher table ( ECX value mod length cipher_table) + ECX value )
Incorrect. Should be:
buffer = buffer_value - ( byte from cipher table ( CL value mod length cipher_table) + CL value )
Example of decrypted BW.bin in attachment
Re: Aika Bin files encryption-decryption
Ok sorry for taking ur time time to eat assembler and get info how to take cl from ecx etc now for me is a black magic ( 0 assembler before ) and assembler logic too. Still dont know what is what ,what have what lenght etc in that examples lol.
Re: Aika Bin files encryption-decryption
azifaralus88,
Come learn assembler from scratch otherwise you will not understand anything at all
Re: Aika Bin files encryption-decryption
Yea I understand a bit but all logic together make to big amount thing to connect to create proper image how its work ... Any good scratch to learn from? Is small amount of books about asm on internet btw ...
Re: Aika Bin files encryption-decryption
azifaralus88
You can check our tutorial / programming section