The Forum is up for sale: XeNTaX Forum looking for new owner

Alpha Prima RES

The Original Forum. Game archives, full of resources. How to open them? Get help here.
Vash
mega-veteran
mega-veteran
Posts: 183
Joined: Fri Apr 29, 2005 2:39 pm
Has thanked: 5 times
Been thanked: 26 times

Alpha Prima RES

Post by Vash »

The contents of this post was deleted because of possible forum rules violation.
mambox
mega-veteran
mega-veteran
Posts: 190
Joined: Wed Mar 24, 2004 2:06 pm
Has thanked: 5 times
Been thanked: 4 times

Post by mambox »

i'm afraid its a bit xoring method but not a single xor value.

well...it dont bring more to help.
Vash
mega-veteran
mega-veteran
Posts: 183
Joined: Fri Apr 29, 2005 2:39 pm
Has thanked: 5 times
Been thanked: 26 times

Post by Vash »

xor? dammit...
mambox
mega-veteran
mega-veteran
Posts: 190
Joined: Wed Mar 24, 2004 2:06 pm
Has thanked: 5 times
Been thanked: 4 times

Post by mambox »

nothing new on this?
Rheini
Moderator
Posts: 652
Joined: Wed Oct 18, 2006 9:48 pm
Location: Germany
Has thanked: 19 times
Been thanked: 46 times
Contact:

Post by Rheini »

for non-trivial encryption disassemble the exe. :)
Mr.Mouse
Site Admin
Posts: 4073
Joined: Wed Jan 15, 2003 6:45 pm
Location: Dungeons of Doom
Has thanked: 450 times
Been thanked: 680 times
Contact:

Post by Mr.Mouse »

I don't know if this is indeed a XOR method. This could also be a table encryption (at least for the filenames that is). Just look a the filenames, it might be they have a table for each valid character in a filename and use that to encrypt it.
Mr.Mouse
Site Admin
Posts: 4073
Joined: Wed Jan 15, 2003 6:45 pm
Location: Dungeons of Doom
Has thanked: 450 times
Been thanked: 680 times
Contact:

Post by Mr.Mouse »

LOL I figured it out, it's a funny encryption method. Let me get back to you later with a RES->NORMAL ZIP converter. ;) I must be insane to do this type of riddles.
Rheini
Moderator
Posts: 652
Joined: Wed Oct 18, 2006 9:48 pm
Location: Germany
Has thanked: 19 times
Been thanked: 46 times
Contact:

Post by Rheini »

You figured out the encryption method just by looking at the file?
Mr.Mouse
Site Admin
Posts: 4073
Joined: Wed Jan 15, 2003 6:45 pm
Location: Dungeons of Doom
Has thanked: 450 times
Been thanked: 680 times
Contact:

Post by Mr.Mouse »

Rheini wrote:You figured out the encryption method just by looking at the file?
No, I looked at the executable. :)
Mr.Mouse
Site Admin
Posts: 4073
Joined: Wed Jan 15, 2003 6:45 pm
Location: Dungeons of Doom
Has thanked: 450 times
Been thanked: 680 times
Contact:

Post by Mr.Mouse »

ok, here's a list of the files in the dat02.res, I wrote a little lister to test the decryption method.

Code: Select all

Decrypt RES: d:\data\tools\data02.res
SCRIPTS/
SCRIPTS/animset.h
SCRIPTS/class_creature/
SCRIPTS/class_creature/ai.h
SCRIPTS/class_creature/ai2.h
SCRIPTS/class_creature/boss.h
SCRIPTS/class_creature/humanoids.h
SCRIPTS/class_creature/npc.h
SCRIPTS/class_creature/robots.h
SCRIPTS/class_func.h
SCRIPTS/class_info.h
SCRIPTS/class_info_cutscene.h
SCRIPTS/class_item.h
SCRIPTS/class_item_weapon.h
SCRIPTS/class_light.h
SCRIPTS/class_misc_model.h
SCRIPTS/class_misc_physics_model.h
SCRIPTS/class_misc_physics_pack.h
SCRIPTS/class_particle.h
SCRIPTS/class_shot.h
SCRIPTS/class_trigger.h
SCRIPTS/console.h
SCRIPTS/definitions/
SCRIPTS/definitions/anim.h
SCRIPTS/definitions/animset.h
SCRIPTS/definitions/gameplay.h
SCRIPTS/definitions/globals.h
SCRIPTS/definitions/items.h
SCRIPTS/definitions/items_def.h
SCRIPTS/definitions/keys.h
SCRIPTS/definitions/shoteffects.h
SCRIPTS/definitions/sounds.h
SCRIPTS/definitions/soundsets.h
SCRIPTS/definitions/speechset.h
SCRIPTS/definitions/strings.h
SCRIPTS/editor.h
SCRIPTS/editor_links.h
SCRIPTS/editor_main.c
SCRIPTS/editor_path.h
SCRIPTS/func_display.h
SCRIPTS/hud.h
SCRIPTS/menu.h
SCRIPTS/music_player.h
SCRIPTS/player/
SCRIPTS/player/interface.h
SCRIPTS/player/player.h
SCRIPTS/proto.h
SCRIPTS/pviewer.h
SCRIPTS/script.c
SCRIPTS/shaders.h
SCRIPTS/soundset.h
SCRIPTS/super.h
SCRIPTS/super2.h
SCRIPTS/super_actor.h
SCRIPTS/viewer.h
strings.xml
As you can see, it works. :D Now for a real converter. :wink:
Mr.Mouse
Site Admin
Posts: 4073
Joined: Wed Jan 15, 2003 6:45 pm
Location: Dungeons of Doom
Has thanked: 450 times
Been thanked: 680 times
Contact:

Post by Mr.Mouse »

The encryption method for the filenames is as follows:

Code: Select all

// Alpha Prime *.RES - Filename Encryption
// Demystified by M.W.Zuurman (Mr.Mouse/Xentax)
// 
// General idea:
//
// 1. The encryption XORs the characters in the strings with a seed value 
// 2. The seed value is the ascii-code of a letter picked from the encryption string 'insanity' 
//
// The method to pick the right character from the encryption string is:
//
// 1. Take the position of the character to be XORed (starting from 0)
// 2. AND this value with 7 
// 3. Look up the character in the encryption string that is at this position
// 4. XOR the character in the original string with the ASCII value of that encryption character
// 5. Loop this until the whole string is encrypted
//
// In raw useless code: 
//
// Declare and assign the following variables:
int Count ; // counter to loop through each character in the original string (OString)
int Lookup ; // Lookup value to get the character from the encryption string 'insanity' (EString)
int SSize ; // the size of the original string 

while (Count < SSize) {
Lookup = Count AND 7;
DString[Count] = OString[Count] XOR EString[Lookup] ;
Count += 1 ;
}

// That should be it in schematic code. 
// Note that the filenames will never be long enough for the 'AND 7' method to fail getting a number between 0 and 7.
Rheini
Moderator
Posts: 652
Joined: Wed Oct 18, 2006 9:48 pm
Location: Germany
Has thanked: 19 times
Been thanked: 46 times
Contact:

Post by Rheini »

Mr.Mouse wrote:// Note that the filenames will never be long enough for the 'AND 7' method to fail getting a number between 0 and 7.
Nice encryption method :D
What do you mean with "will never be long enough"? ANDing a number with 7 always gives you a value between 0 and 7.
Is every string encrypted individually or is it a block encryption?
Mr.Mouse
Site Admin
Posts: 4073
Joined: Wed Jan 15, 2003 6:45 pm
Location: Dungeons of Doom
Has thanked: 450 times
Been thanked: 680 times
Contact:

Post by Mr.Mouse »

Yes, I was referring to variable conversion types. Never mind. :)

Each string is encrypted individually. :) I gave away a bit of the method last night when I said: "I must be insane to do this type of riddles.". :P
Mr.Mouse
Site Admin
Posts: 4073
Joined: Wed Jan 15, 2003 6:45 pm
Location: Dungeons of Doom
Has thanked: 450 times
Been thanked: 680 times
Contact:

Post by Mr.Mouse »

It's amazing what you can find on the internet these days. Found this command line driven tool on a Russian site. It's by Xplorer and will do that for which I wanted to create a new program.

http://www.xentax.com/uploads/author/mr ... es2zip.zip

This will correct the res file and make it a zip archive again. ;)
mambox
mega-veteran
mega-veteran
Posts: 190
Joined: Wed Mar 24, 2004 2:06 pm
Has thanked: 5 times
Been thanked: 4 times

Post by mambox »

amazing but not easy to find...well...you rock ;)
Post Reply