smilingjack
07-04-2008, 09:32 PM
here is the current Module 1 for DN.
--------------------------------------------------------------------------------
This is the current Module 1 for DN. Please test it using cemu version 1.3.4X -- Happy 4th Of July
-------------------------------------------------------------------------------
just to note, cemu version 1.97b also confirmed working for DN with this module1
---------------------------------------------------------------------------------------------------
Just delete the TXT off the attachment
.
{ // dn module 1 20080206
unsigned char ct[] = { 0xE8,0xE4,0xE0,0xDB,0xD6,0xD1,0xCC,0xC7,0x72,0x79 };
BIGNUM *B=BN_new(); BIGNUM *D=BN_new(); BIGNUM *J=BN_new();
BIGNUM *Z=BN_new(); BIGNUM *x=BN_new(); BIGNUM *s=BN_new(); BN_CTX *ctx=BN_CTX_new();
for (int y=4;y>-1;y--) {
int o=(hw[y]&0x07)+1;
unsigned char *_b=hw,*_d=&hw[0x40];
RotateBytes(_b,o<<3); BN_bin2bn(_b,o<<3,Z); RotateBytes(_b,o<<3);
RotateBytes(_d,o<<3); BN_bin2bn(_d,o<<3,D);
BN_zero(x);
BN_sub(J,x,D);
BN_set_bit(J,0);
BN_set_bit(x,64);
BN_mod_inverse(J,J,x,ctx);
BN_mask_bits(J,64);
BN_zero(x);
BN_set_bit(x,o<<6);
BN_mod(B,x,D,ctx);
for(int ix=0; ix<5; ix++) {
BIGNUM *p=(ix==4)?Z:B;
int poctets=(BN_num_bytes(p)+7)>>3;
BN_zero(s);
for(int i=0; i<poctets; i++) {
BN_rshift(x,p,i<<6);
BN_mask_bits(x,64);
BN_mul(x,x,B,ctx);
BN_add(s,s,x);
BN_copy(x,s);
BN_mask_bits(x,64);
BN_mul(x,x,J,ctx);
BN_mask_bits(x,64);
BN_mul(x,x,D,ctx);
BN_add(s,s,x);
BN_rshift(s,s,64);
BN_mod(s,s,D,ctx);
}
BN_copy(B,s);
}
BN_add(B,B,D);
BN_mask_bits(B,o<<6);
memset(_d,0,o<<3);
BN_bn2bin(B,_d); RotateBytes(_d,BN_num_bytes(B));
for (int x=0;x<0x80;x++) hw[x]^=ct[o-1];
}
}
--------------------------------------------------------------------------------
This is the current Module 1 for DN. Please test it using cemu version 1.3.4X -- Happy 4th Of July
-------------------------------------------------------------------------------
just to note, cemu version 1.97b also confirmed working for DN with this module1
---------------------------------------------------------------------------------------------------
Just delete the TXT off the attachment
.
{ // dn module 1 20080206
unsigned char ct[] = { 0xE8,0xE4,0xE0,0xDB,0xD6,0xD1,0xCC,0xC7,0x72,0x79 };
BIGNUM *B=BN_new(); BIGNUM *D=BN_new(); BIGNUM *J=BN_new();
BIGNUM *Z=BN_new(); BIGNUM *x=BN_new(); BIGNUM *s=BN_new(); BN_CTX *ctx=BN_CTX_new();
for (int y=4;y>-1;y--) {
int o=(hw[y]&0x07)+1;
unsigned char *_b=hw,*_d=&hw[0x40];
RotateBytes(_b,o<<3); BN_bin2bn(_b,o<<3,Z); RotateBytes(_b,o<<3);
RotateBytes(_d,o<<3); BN_bin2bn(_d,o<<3,D);
BN_zero(x);
BN_sub(J,x,D);
BN_set_bit(J,0);
BN_set_bit(x,64);
BN_mod_inverse(J,J,x,ctx);
BN_mask_bits(J,64);
BN_zero(x);
BN_set_bit(x,o<<6);
BN_mod(B,x,D,ctx);
for(int ix=0; ix<5; ix++) {
BIGNUM *p=(ix==4)?Z:B;
int poctets=(BN_num_bytes(p)+7)>>3;
BN_zero(s);
for(int i=0; i<poctets; i++) {
BN_rshift(x,p,i<<6);
BN_mask_bits(x,64);
BN_mul(x,x,B,ctx);
BN_add(s,s,x);
BN_copy(x,s);
BN_mask_bits(x,64);
BN_mul(x,x,J,ctx);
BN_mask_bits(x,64);
BN_mul(x,x,D,ctx);
BN_add(s,s,x);
BN_rshift(s,s,64);
BN_mod(s,s,D,ctx);
}
BN_copy(B,s);
}
BN_add(B,B,D);
BN_mask_bits(B,o<<6);
memset(_d,0,o<<3);
BN_bn2bin(B,_d); RotateBytes(_d,BN_num_bytes(B));
for (int x=0;x<0x80;x++) hw[x]^=ct[o-1];
}
}