@@ -21,10 +21,10 @@ void substitute(char* input, char* output, int multiply_by)
21
21
output [0x18 ] = 0 ;
22
22
}
23
23
24
- int the_crazy_math_part (unsigned int val1 , unsigned int val2 )
24
+ int the_crazy_math_part (unsigned int val1 , unsigned int val2 , int carry )
25
25
{
26
- int c = 0 ;
27
-
26
+ int c = carry ;
27
+
28
28
long long r1 = 0xFFFFFFF9 ;
29
29
long long r0 = val1 ;
30
30
long long r3 = val2 ;
@@ -57,8 +57,7 @@ int the_crazy_math_part(unsigned int val1, unsigned int val2)
57
57
}
58
58
59
59
60
- char * ascii_to_byte (char * enc , char * input )
61
-
60
+ char * find_pattern (char * enc , char * input )
62
61
{
63
62
int i ;
64
63
int ii ;
@@ -87,35 +86,25 @@ char* ascii_to_byte(char* enc, char* input)
87
86
88
87
int find_multiplier (char * system_in , unsigned int maccasId )
89
88
{
90
- int system_in_len ;
91
- byte * next_var ;
92
- byte * this_char ;
93
- byte * extraout_r1 ;
94
89
unsigned int total_iterations ;
95
90
int i = 0 ;
96
91
int ii = 0 ;
97
- byte * system_in_2 ;
98
- unsigned int c ;
99
- char * starting_inc ;
100
92
101
93
total_iterations = 0 ;
102
- c = maccasId & 0xffff00ff ;
103
- system_in_len = strlen (system_in );
104
- starting_inc = hex_values ;
105
- system_in_2 = (byte * )system_in ;
94
+ unsigned int c = maccasId & 0xffff00ff ;
95
+ int system_in_len = strlen (system_in );
96
+ char * hex_values_ptr = hex_values ;
106
97
if (0 < system_in_len ) {
107
98
do {
108
- system_in_2 = system_in_2 + 1 ;
109
- c = c & 0xffffff00 | (unsigned int )* system_in_2 ;
110
- next_var = ascii_to_byte (( byte * ) starting_inc , (byte * )& c );
111
- this_char = next_var + - (int )starting_inc ;
112
- if (next_var == (byte * )0x0 ) {
99
+ system_in ++ ;
100
+ c = c & 0xffffff00 | (unsigned int )* system_in ;
101
+ byte * next_ptr = next_ptr = find_pattern ( hex_values_ptr , (char * )& c );
102
+ byte * this_char = next_ptr + - (int )hex_values_ptr ;
103
+ if (next_ptr == (byte * )0x0 ) {
113
104
this_char = (byte * )0x0 ;
114
105
}
115
106
i = i + 1 ;
116
107
total_iterations = (unsigned int )(this_char + total_iterations );
117
- system_in_len = strlen (system_in );
118
- system_in_2 = system_in_2 ;
119
108
} while (i < system_in_len );
120
109
}
121
110
@@ -124,23 +113,38 @@ int find_multiplier(char* system_in, unsigned int maccasId)
124
113
int ret ;
125
114
unsigned int offset = 7 ;
126
115
127
- if (offset <= total_iterations ) {
116
+ if (offset <= total_iterations )
117
+ {
118
+ int c = 0 ;
128
119
i = 0x1c ;
129
- ii = total_iterations >> 4 ;
130
- if ((int )offset <= (int )(total_iterations >> 0x10 )) {
131
- i = 0xc ;
132
- ii = total_iterations >> 0x14 ;
120
+ unsigned int r3 = total_iterations >> 4 ;
121
+ if (offset <= r3 >> 0xC )
122
+ {
123
+ i -= 0x10 ;
124
+ r3 <<= 0x10 ;
133
125
}
134
- if ((int )offset <= (int )(ii >> 4 )) {
135
- i = i - 8 ;
136
- ii = ii >> 8 ;
126
+ if (offset <= r3 >> 0x10 )
127
+ {
128
+ i -= 0x8 ;
129
+ r3 <<= 0x8 ;
137
130
}
138
- if ((int )offset <= (int )ii ) {
139
- i = i - 4 ;
140
- ii = ii >> 4 ;
131
+ if (offset <= r3 )
132
+ {
133
+ i -= 0x4 ;
134
+ r3 <<= 0x4 ;
141
135
}
142
136
143
- return the_crazy_math_part ((total_iterations << (i & 0xff )) * 2 , ii );
137
+ unsigned int r0 = total_iterations << (i & 0xFF );
138
+
139
+ i = i + i * 2 ;
140
+
141
+ c = ((long long int )r0 * 2 ) > 0xFFFFFFFF ;
142
+ r0 = r0 * 2 ;
143
+
144
+ printf ("Starting Carry: %x\n" , c );
145
+
146
+
147
+ return the_crazy_math_part (r0 , r3 , c );
144
148
}
145
149
return 0 ;
146
150
}
@@ -162,7 +166,7 @@ unsigned int hex_to_bytes(char* input, int iterator, int multiplier)
162
166
memset (curChar , 0x00 , 2 );
163
167
curChar [0 ] = current_char [0 ];
164
168
165
- iteration = ascii_to_byte (enc , curChar );
169
+ iteration = find_pattern (enc , curChar );
166
170
final_char = iteration + - (int )enc ;
167
171
if (iteration == (char * )0x0 ) {
168
172
final_char = (char * )0x0 ;
@@ -189,69 +193,79 @@ void generate_password(unsigned short* input, char* output)
189
193
190
194
int main ()
191
195
{
192
- char maccas_id [7 ];
193
- char mannager_id [7 ];
194
- char mac_address [18 ];
196
+ char maccas_id [64 ];
197
+ char mannager_id [64 ];
198
+ char mac_address [64 ];
195
199
char formatted [64 ];
196
200
char encoded [64 ];
197
201
char temp_key [100 ];
198
202
char final_key [100 ];
199
203
char total_output [64 ];
204
+ int iterator = 0 ;
205
+ int i = 0 ;
206
+ int ii = 0 ;
207
+
200
208
printf ("eCDP Serial Number Generator (By SilicaAndPina)\n" );
201
209
printf ("-- A backdoor on the worlds rarest DS game.\n" );
210
+ entry :
211
+
202
212
printf ("Enter your NDS's Mac Address (without any seperators): " );
203
- gets_s (mac_address , 18 );
213
+ gets_s (mac_address , 64 );
214
+ if (strlen (mac_address ) != 12 )
215
+ goto entry ;
216
+
217
+
204
218
printf ("Enter McDonalds Store Id (first 6 digit entry): " );
205
- gets_s (maccas_id ,7 );
206
- printf ( "Enter McDonalds Manager Id (second 6 digit entry): " );
207
- gets_s ( mannager_id , 7 ) ;
219
+ gets_s (maccas_id ,64 );
220
+ if ( strlen ( maccas_id ) != 6 )
221
+ goto entry ;
208
222
209
223
224
+ printf ("Enter McDonalds Manager Id (second 6 digit entry): " );
225
+ gets_s (mannager_id , 64 );
226
+ if (strlen (mannager_id ) != 6 )
227
+ goto entry ;
228
+
210
229
snprintf (formatted , 64 , "%s%s%s" , mac_address , maccas_id , mannager_id );
211
230
printf ("Formatted Data: %s\n" , formatted );
212
-
213
231
int multiplier = find_multiplier (formatted , (unsigned int )maccas_id );
214
232
printf ("Multiplier: %x\n" , multiplier );
215
233
substitute (formatted , encoded , multiplier );
216
234
printf ("Encoded Data: %s\n" , encoded );
217
-
218
235
unsigned short password_values [6 ];
219
236
memset (password_values , 0x00 , 6 * 2 );
220
- int iterator = 0 ;
221
- int i = 0 ;
222
- int ii = 0 ;
237
+
223
238
do {
224
239
int chr = hex_to_bytes (encoded , iterator , multiplier );
225
240
i = ii + 1 ;
226
241
password_values [ii ] = (unsigned short )chr ;
227
242
iterator = iterator + 4 ;
228
243
ii = i ;
229
244
} while (i < 6 );
230
-
245
+
231
246
printf ("Password Values 1: " );
232
247
for (int i = 0 ; i < 6 ; i ++ )
233
248
{
234
249
printf ("%x " , password_values [i ]);
235
250
}
236
251
printf ("\n" );
237
- int magic_number = 0x3E0F83E1 ;
238
-
252
+ i = 0 ;
239
253
ii = 0 ;
240
- do {
241
- short chr = password_values [ii ];
242
- iterator = ii + 1 ;
243
- password_values [ii ] = chr + (short )(int )((long long )magic_number * (long long )(int )(unsigned int )chr >> 0x23 ) * -0x21 + 1 ;
244
- ii = iterator ;
245
- } while (iterator < 6 );
246
-
254
+ do
255
+ {
256
+ i = ii ;
257
+ int chr = password_values [ii ++ ];
258
+ password_values [i ] = chr % 33 + 1 ;
259
+ } while (ii < 6 );
247
260
printf ("Password Values 2: " );
248
261
for (int i = 0 ; i < 6 ; i ++ )
249
262
{
250
263
printf ("%x " , password_values [i ]);
251
264
}
252
265
printf ("\n" );
253
266
generate_password (password_values , final_key );
254
- printf ("Ronald McDonald Says your password is %s\n" , final_key );
267
+ printf ("Ronald McDonald Says your password is %s" , final_key );
268
+
255
269
256
270
printf ("\n\nThou hast been reversed!" );
257
271
while (1 ) {};
0 commit comments