Simplified Atomiswave's decryption routine & keys. [Andreas Naive]

-----
Furthermore, i have uploaded a new revision of the cracking tool to 
/encryption/aw_key_distiller.zip
This commit is contained in:
Andreas Naive 2009-07-29 21:59:55 +00:00
parent 71d9499524
commit 059b62aa1d
2 changed files with 35 additions and 42 deletions

View File

@ -98,7 +98,7 @@ endif
#-------------------------------------------------
# uncomment next line to build a debug version
# DEBUG = 1
DEBUG = 1
# uncomment next line to include the internal profiler
# PROFILER = 1

View File

@ -5163,62 +5163,57 @@ GAME( 2004, vf4tuneda,vf4tuned,naomigd, naomi, 0, ROT0, "Sega", "
*
*********************************************/
struct AtomiswaveKey
typedef struct _atomiswave_key atomiswave_key;
struct _atomiswave_key
{
int P0[16];
int P1[16];
int S0[32];
int S1[16];
int S2[16];
int S3[8];
};
static const struct AtomiswaveKey fotns_key = {
{0,2,7,11,12,1,5,6,15,4,8,9,14,3,10,13},
{12,8,3,7,0,15,1,11,6,10,4,14,9,5,13,2},
{4,1,10,16,9,25,26,31,13,0,14,15,24,6,30,18,7,20,5,12,22,17,27,3,8,11,21,29,19,23,28,2},
{3,2,11,14,10,13,12,0,7,6,8,15,5,1,4,9},
{10,3,6,12,7,11,4,14,0,2,8,1,15,13,5,9},
{7,1,6,5,4,2,0,3}
static const atomiswave_key ssu_key = {
{8,10,1,3,7,4,11,2,5,15,6,0,12,13,9,14},
{4,12,8,14,16,30,31,0,23,29,24,21,11,22,27,5,3,20,18,26,10,7,17,1,28,6,15,13,2,9,25,19},
{13,1,0,9,5,12,4,14,3,15,2,10,11,6,8,7},
{7,13,4,6,5,9,3,2,0,15,12,10,8,11,1,14},
{4,0,1,2,5,7,3,6}
};
static const struct AtomiswaveKey df_key = {
{1,4,5,6,9,7,10,11,13,0,8,12,14,2,3,15},
{12,0,3,8,7,6,15,11,1,4,14,10,9,5,13,2},
{9,27,15,6,28,30,7,12,21,0,1,25,22,3,16,29,13,4,24,20,2,5,23,19,18,10,8,14,17,11,31,26},
{5,13,4,0,8,12,14,7,2,11,3,10,6,1,15,9},
{11,6,2,9,12,1,7,4,10,0,13,3,8,14,15,5},
{1,6,4,3,5,2,7,0}
static const atomiswave_key df_key = {
{4,5,9,6,1,13,7,11,10,0,14,12,8,15,2,3},
{9,15,28,7,13,24,2,23,21,1,22,16,18,8,17,31,27,6,30,12,4,20,5,19,0,25,3,29,10,14,11,26},
{5,2,13,11,8,6,12,1,4,3,0,10,14,15,7,9},
{11,6,10,0,12,1,8,14,2,9,13,3,7,4,15,5},
{1,5,6,2,4,7,3,0}
};
struct AtomiswaveKey ssu_key = {
{1,3,7,8,10,2,4,5,11,0,6,12,15,9,13,14},
{7,8,12,0,3,11,1,15,6,10,9,14,4,5,2,13},
{4,16,23,11,3,10,28,2,12,30,29,22,20,7,6,9,8,31,24,27,18,17,15,25,14,0,21,5,26,1,13,19},
{13,5,1,12,3,11,15,6,0,4,9,14,2,8,10,7},
{7,5,4,3,0,8,12,1,13,9,6,2,15,11,10,14},
{4,1,0,2,5,3,7,6}
static const atomiswave_key rm_key = {
{4,5,9,6,1,13,7,11,10,0,14,12,8,15,2,3},
{3,0,14,17,10,15,31,20,13,2,29,28,9,18,25,27,6,19,30,22,7,12,1,16,23,11,24,4,8,26,21,5},
{2,10,6,9,11,13,4,5,3,15,7,14,12,1,0,8},
{1,13,11,3,8,7,9,10,12,15,4,14,0,5,6,2},
{6,5,0,3,7,1,4,2}
};
struct AtomiswaveKey rm_key = {
{1,4,5,6,9,7,10,11,13,0,8,12,14,2,3,15},
{12,0,3,8,7,6,15,11,1,4,14,10,9,5,13,2},
{3,6,0,19,14,30,17,22,13,23,2,11,29,24,28,4,10,7,15,12,31,1,20,16,9,8,18,26,25,21,27,5},
{2,6,3,7,11,4,12,0,10,9,15,14,13,5,1,8},
{1,13,12,15,8,7,0,5,11,3,4,14,9,10,6,2},
{6,0,7,4,5,3,1,2}
static const atomiswave_key fotns_key = {
{12,7,11,2,0,5,15,6,1,8,14,4,9,13,3,10},
{4,7,9,22,13,8,24,19,10,5,26,27,14,21,30,28,1,20,25,17,0,11,6,23,16,12,31,3,15,29,18,2},
{3,11,7,8,10,12,5,4,2,14,6,15,13,0,1,9},
{10,6,0,8,3,12,2,1,7,4,15,5,11,14,13,9},
{7,4,1,2,6,0,5,3}
};
struct AtomiswaveKey xh_key = {
{0,2,7,11,12,1,5,6,15,4,8,9,14,3,10,13},
{12,8,3,7,0,15,1,11,6,10,4,14,9,5,13,2},
{4,3,23,28,8,18,24,15,16,10,11,2,31,17,27,25,12,20,29,6,14,26,21,13,30,7,22,9,0,1,5,19,},
{13,3,1,15,5,11,12,6,0,2,9,10,4,8,14,7,},
{7,5,13,9,0,8,15,11,4,3,6,2,12,1,10,14,},
{4,1,5,3,0,2,7,6}
static const atomiswave_key xh_key = {
{12,7,11,2,0,5,15,6,1,8,14,4,9,13,3,10},
{4,12,8,14,16,30,31,0,23,29,24,21,11,22,27,5,3,20,18,26,10,7,17,1,28,6,15,13,2,9,25,19},
{13,1,0,9,5,12,4,14,3,15,2,10,11,6,8,7},
{7,13,4,6,5,9,3,2,0,15,12,10,8,11,1,14},
{4,0,1,2,5,7,3,6}
};
static UINT16 atomiswave_decrypt(UINT16 cipherText, int address, const struct AtomiswaveKey* key)
static UINT16 atomiswave_decrypt(UINT16 cipherText, int address, const atomiswave_key* key)
{
int b0,b1,b2,b3;
int aux;
@ -5226,9 +5221,7 @@ static UINT16 atomiswave_decrypt(UINT16 cipherText, int address, const struct At
aux = BITSWAP16(cipherText,
key->P0[15],key->P0[14],key->P0[13],key->P0[12],key->P0[11],key->P0[10],key->P0[9],key->P0[8],
key->P0[7],key->P0[6],key->P0[5],key->P0[4],key->P0[3],key->P0[2],key->P0[1],key->P0[0]);
aux = aux ^ BITSWAP16(address/2,
key->P1[15],key->P1[14],key->P1[13],key->P1[12],key->P1[11],key->P1[10],key->P1[9],key->P1[8],
key->P1[7],key->P1[6],key->P1[5],key->P1[4],key->P1[3],key->P1[2],key->P1[1],key->P1[0]);
aux = aux ^ BITSWAP16(address/2, 13,5,2, 14,10,9,4, 15,11,6,1, 12,8,7,3,0);
b0 = aux&0x1f;
b1 = (aux>>5)&0xf;