Initial commit
[hashcat.git] / nv / m04800_a3.cu
1 /**
2  * Author......: Jens Steube <jens.steube@gmail.com>
3  * License.....: MIT
4  */
5
6 #define _MD5_
7
8 #include "include/constants.h"
9 #include "include/kernel_vendor.h"
10
11 #ifdef  VLIW1
12 #define VECT_SIZE1
13 #endif
14
15 #ifdef  VLIW2
16 #define VECT_SIZE4
17 #endif
18
19 #define DGST_R0 0
20 #define DGST_R1 3
21 #define DGST_R2 2
22 #define DGST_R3 1
23
24 #include "include/kernel_functions.c"
25 #include "types_nv.c"
26 #include "common_nv.c"
27
28 #ifdef  VECT_SIZE1
29 #define VECT_COMPARE_S "check_single_vect1_comp4.c"
30 #define VECT_COMPARE_M "check_multi_vect1_comp4.c"
31 #endif
32
33 #ifdef  VECT_SIZE2
34 #define VECT_COMPARE_S "check_single_vect2_comp4.c"
35 #define VECT_COMPARE_M "check_multi_vect2_comp4.c"
36 #endif
37
38 #ifdef  VECT_SIZE4
39 #define VECT_COMPARE_S "check_single_vect4_comp4.c"
40 #define VECT_COMPARE_M "check_multi_vect4_comp4.c"
41 #endif
42
43 __device__ __constant__ bf_t c_bfs[1024];
44
45 __device__ static void m04800m (u32x w0[4], u32x w1[4], u32x w2[4], u32x w3[4], const u32 pw_len, const pw_t *pws, const gpu_rule_t *rules_buf, const comb_t *combs_buf, const bf_t *bfs_buf, const void *tmps, void *hooks, const u32 *bitmaps_buf_s1_a, const u32 *bitmaps_buf_s1_b, const u32 *bitmaps_buf_s1_c, const u32 *bitmaps_buf_s1_d, const u32 *bitmaps_buf_s2_a, const u32 *bitmaps_buf_s2_b, const u32 *bitmaps_buf_s2_c, const u32 *bitmaps_buf_s2_d, plain_t *plains_buf, const digest_t *digests_buf, u32 *hashes_shown, const salt_t *salt_bufs, const void *esalt_bufs, u32 *d_return_buf, u32 *d_scryptV_buf, const u32 bitmap_mask, const u32 bitmap_shift1, const u32 bitmap_shift2, const u32 salt_pos, const u32 loop_pos, const u32 loop_cnt, const u32 bfs_cnt, const u32 digests_cnt, const u32 digests_offset)
46 {
47   /**
48    * modifier
49    */
50
51   const u32 gid = (blockIdx.x * blockDim.x) + threadIdx.x;
52   const u32 lid = threadIdx.x;
53
54   /**
55    * salt
56    */
57
58   u32 salt_buf[5];
59
60   salt_buf[0] = salt_bufs[salt_pos].salt_buf[0];
61   salt_buf[1] = salt_bufs[salt_pos].salt_buf[1];
62   salt_buf[2] = salt_bufs[salt_pos].salt_buf[2];
63   salt_buf[3] = salt_bufs[salt_pos].salt_buf[3];
64   salt_buf[4] = salt_bufs[salt_pos].salt_buf[4];
65
66   const u32 salt_len = salt_bufs[salt_pos].salt_len;
67
68   const u32 pw_salt_len = pw_len + salt_len;
69
70   u32 s0[4];
71
72   s0[0] = salt_buf[0];
73   s0[1] = salt_buf[1];
74   s0[2] = salt_buf[2];
75   s0[3] = salt_buf[3];
76
77   u32 s1[4];
78
79   s1[0] = 0x80;
80   s1[1] = 0;
81   s1[2] = 0;
82   s1[3] = 0;
83
84   u32 s2[4];
85
86   s2[0] = 0;
87   s2[1] = 0;
88   s2[2] = 0;
89   s2[3] = 0;
90
91   u32 s3[4];
92
93   s3[0] = 0;
94   s3[1] = 0;
95   s3[2] = 0;
96   s3[3] = 0;
97
98   // move w by 1
99
100   u32x w0_t[4];
101
102   w0_t[0] = w0[0];
103   w0_t[1] = w0[1];
104   w0_t[2] = w0[2];
105   w0_t[3] = w0[3];
106
107   u32x w1_t[4];
108
109   w1_t[0] = w1[0];
110   w1_t[1] = w1[1];
111   w1_t[2] = w1[2];
112   w1_t[3] = w1[3];
113
114   u32x w2_t[4];
115
116   w2_t[0] = 0;
117   w2_t[1] = 0;
118   w2_t[2] = 0;
119   w2_t[3] = 0;
120
121   u32x w3_t[4];
122
123   w3_t[0] = 0;
124   w3_t[1] = 0;
125   w3_t[2] = 0;
126   w3_t[3] = 0;
127
128   switch_buffer_by_offset (w0_t, w1_t, w2_t, w3_t, 1);
129
130   switch_buffer_by_offset (s0, s1, s2, s3, 1 + pw_len);
131
132   w0_t[0] |= s0[0];
133   w0_t[1] |= s0[1];
134   w0_t[2] |= s0[2];
135   w0_t[3] |= s0[3];
136
137   w1_t[0] |= s1[0];
138   w1_t[1] |= s1[1];
139   w1_t[2] |= s1[2];
140   w1_t[3] |= s1[3];
141
142   w2_t[0] |= s2[0];
143   w2_t[1] |= s2[1];
144   w2_t[2] |= s2[2];
145   w2_t[3] |= s2[3];
146
147   w3_t[0] |= s3[0];
148   w3_t[1] |= s3[1];
149   w3_t[2]  = pw_salt_len * 8;
150   w3_t[3]  = 0;
151
152   /**
153    * add id byte
154    */
155
156   w0_t[0] |= salt_buf[4];
157
158   /**
159    * loop
160    */
161
162   u32x w0l = w0_t[0];
163   u32x w1l = w0_t[1];
164
165   for (u32 il_pos = 0; il_pos < bfs_cnt; il_pos++)
166   {
167     const u32 w0r = c_bfs[il_pos].i;
168
169     w0_t[0] = w0l | (w0r <<  8);
170     w0_t[1] = w1l | (w0r >> 24);
171
172     /**
173      * md5
174      */
175
176     u32x a = MD5M_A;
177     u32x b = MD5M_B;
178     u32x c = MD5M_C;
179     u32x d = MD5M_D;
180
181     MD5_STEP (MD5_Fo, a, b, c, d, w0_t[0], MD5C00, MD5S00);
182     MD5_STEP (MD5_Fo, d, a, b, c, w0_t[1], MD5C01, MD5S01);
183     MD5_STEP (MD5_Fo, c, d, a, b, w0_t[2], MD5C02, MD5S02);
184     MD5_STEP (MD5_Fo, b, c, d, a, w0_t[3], MD5C03, MD5S03);
185     MD5_STEP (MD5_Fo, a, b, c, d, w1_t[0], MD5C04, MD5S00);
186     MD5_STEP (MD5_Fo, d, a, b, c, w1_t[1], MD5C05, MD5S01);
187     MD5_STEP (MD5_Fo, c, d, a, b, w1_t[2], MD5C06, MD5S02);
188     MD5_STEP (MD5_Fo, b, c, d, a, w1_t[3], MD5C07, MD5S03);
189     MD5_STEP (MD5_Fo, a, b, c, d, w2_t[0], MD5C08, MD5S00);
190     MD5_STEP (MD5_Fo, d, a, b, c, w2_t[1], MD5C09, MD5S01);
191     MD5_STEP (MD5_Fo, c, d, a, b, w2_t[2], MD5C0a, MD5S02);
192     MD5_STEP (MD5_Fo, b, c, d, a, w2_t[3], MD5C0b, MD5S03);
193     MD5_STEP (MD5_Fo, a, b, c, d, w3_t[0], MD5C0c, MD5S00);
194     MD5_STEP (MD5_Fo, d, a, b, c, w3_t[1], MD5C0d, MD5S01);
195     MD5_STEP (MD5_Fo, c, d, a, b, w3_t[2], MD5C0e, MD5S02);
196     MD5_STEP (MD5_Fo, b, c, d, a, w3_t[3], MD5C0f, MD5S03);
197
198     MD5_STEP (MD5_Go, a, b, c, d, w0_t[1], MD5C10, MD5S10);
199     MD5_STEP (MD5_Go, d, a, b, c, w1_t[2], MD5C11, MD5S11);
200     MD5_STEP (MD5_Go, c, d, a, b, w2_t[3], MD5C12, MD5S12);
201     MD5_STEP (MD5_Go, b, c, d, a, w0_t[0], MD5C13, MD5S13);
202     MD5_STEP (MD5_Go, a, b, c, d, w1_t[1], MD5C14, MD5S10);
203     MD5_STEP (MD5_Go, d, a, b, c, w2_t[2], MD5C15, MD5S11);
204     MD5_STEP (MD5_Go, c, d, a, b, w3_t[3], MD5C16, MD5S12);
205     MD5_STEP (MD5_Go, b, c, d, a, w1_t[0], MD5C17, MD5S13);
206     MD5_STEP (MD5_Go, a, b, c, d, w2_t[1], MD5C18, MD5S10);
207     MD5_STEP (MD5_Go, d, a, b, c, w3_t[2], MD5C19, MD5S11);
208     MD5_STEP (MD5_Go, c, d, a, b, w0_t[3], MD5C1a, MD5S12);
209     MD5_STEP (MD5_Go, b, c, d, a, w2_t[0], MD5C1b, MD5S13);
210     MD5_STEP (MD5_Go, a, b, c, d, w3_t[1], MD5C1c, MD5S10);
211     MD5_STEP (MD5_Go, d, a, b, c, w0_t[2], MD5C1d, MD5S11);
212     MD5_STEP (MD5_Go, c, d, a, b, w1_t[3], MD5C1e, MD5S12);
213     MD5_STEP (MD5_Go, b, c, d, a, w3_t[0], MD5C1f, MD5S13);
214
215     MD5_STEP (MD5_H , a, b, c, d, w1_t[1], MD5C20, MD5S20);
216     MD5_STEP (MD5_H , d, a, b, c, w2_t[0], MD5C21, MD5S21);
217     MD5_STEP (MD5_H , c, d, a, b, w2_t[3], MD5C22, MD5S22);
218     MD5_STEP (MD5_H , b, c, d, a, w3_t[2], MD5C23, MD5S23);
219     MD5_STEP (MD5_H , a, b, c, d, w0_t[1], MD5C24, MD5S20);
220     MD5_STEP (MD5_H , d, a, b, c, w1_t[0], MD5C25, MD5S21);
221     MD5_STEP (MD5_H , c, d, a, b, w1_t[3], MD5C26, MD5S22);
222     MD5_STEP (MD5_H , b, c, d, a, w2_t[2], MD5C27, MD5S23);
223     MD5_STEP (MD5_H , a, b, c, d, w3_t[1], MD5C28, MD5S20);
224     MD5_STEP (MD5_H , d, a, b, c, w0_t[0], MD5C29, MD5S21);
225     MD5_STEP (MD5_H , c, d, a, b, w0_t[3], MD5C2a, MD5S22);
226     MD5_STEP (MD5_H , b, c, d, a, w1_t[2], MD5C2b, MD5S23);
227     MD5_STEP (MD5_H , a, b, c, d, w2_t[1], MD5C2c, MD5S20);
228     MD5_STEP (MD5_H , d, a, b, c, w3_t[0], MD5C2d, MD5S21);
229     MD5_STEP (MD5_H , c, d, a, b, w3_t[3], MD5C2e, MD5S22);
230     MD5_STEP (MD5_H , b, c, d, a, w0_t[2], MD5C2f, MD5S23);
231
232     MD5_STEP (MD5_I , a, b, c, d, w0_t[0], MD5C30, MD5S30);
233     MD5_STEP (MD5_I , d, a, b, c, w1_t[3], MD5C31, MD5S31);
234     MD5_STEP (MD5_I , c, d, a, b, w3_t[2], MD5C32, MD5S32);
235     MD5_STEP (MD5_I , b, c, d, a, w1_t[1], MD5C33, MD5S33);
236     MD5_STEP (MD5_I , a, b, c, d, w3_t[0], MD5C34, MD5S30);
237     MD5_STEP (MD5_I , d, a, b, c, w0_t[3], MD5C35, MD5S31);
238     MD5_STEP (MD5_I , c, d, a, b, w2_t[2], MD5C36, MD5S32);
239     MD5_STEP (MD5_I , b, c, d, a, w0_t[1], MD5C37, MD5S33);
240     MD5_STEP (MD5_I , a, b, c, d, w2_t[0], MD5C38, MD5S30);
241     MD5_STEP (MD5_I , d, a, b, c, w3_t[3], MD5C39, MD5S31);
242     MD5_STEP (MD5_I , c, d, a, b, w1_t[2], MD5C3a, MD5S32);
243     MD5_STEP (MD5_I , b, c, d, a, w3_t[1], MD5C3b, MD5S33);
244     MD5_STEP (MD5_I , a, b, c, d, w1_t[0], MD5C3c, MD5S30);
245     MD5_STEP (MD5_I , d, a, b, c, w2_t[3], MD5C3d, MD5S31);
246     MD5_STEP (MD5_I , c, d, a, b, w0_t[2], MD5C3e, MD5S32);
247     MD5_STEP (MD5_I , b, c, d, a, w2_t[1], MD5C3f, MD5S33);
248
249     const u32x r0 = a;
250     const u32x r1 = d;
251     const u32x r2 = c;
252     const u32x r3 = b;
253
254     #include VECT_COMPARE_M
255   }
256 }
257
258 __device__ static void m04800s (u32x w0[4], u32x w1[4], u32x w2[4], u32x w3[4], const u32 pw_len, const pw_t *pws, const gpu_rule_t *rules_buf, const comb_t *combs_buf, const bf_t *bfs_buf, const void *tmps, void *hooks, const u32 *bitmaps_buf_s1_a, const u32 *bitmaps_buf_s1_b, const u32 *bitmaps_buf_s1_c, const u32 *bitmaps_buf_s1_d, const u32 *bitmaps_buf_s2_a, const u32 *bitmaps_buf_s2_b, const u32 *bitmaps_buf_s2_c, const u32 *bitmaps_buf_s2_d, plain_t *plains_buf, const digest_t *digests_buf, u32 *hashes_shown, const salt_t *salt_bufs, const void *esalt_bufs, u32 *d_return_buf, u32 *d_scryptV_buf, const u32 bitmap_mask, const u32 bitmap_shift1, const u32 bitmap_shift2, const u32 salt_pos, const u32 loop_pos, const u32 loop_cnt, const u32 bfs_cnt, const u32 digests_cnt, const u32 digests_offset)
259 {
260   /**
261    * modifier
262    */
263
264   const u32 gid = (blockIdx.x * blockDim.x) + threadIdx.x;
265   const u32 lid = threadIdx.x;
266
267   /**
268    * salt
269    */
270
271   u32 salt_buf[5];
272
273   salt_buf[0] = salt_bufs[salt_pos].salt_buf[0];
274   salt_buf[1] = salt_bufs[salt_pos].salt_buf[1];
275   salt_buf[2] = salt_bufs[salt_pos].salt_buf[2];
276   salt_buf[3] = salt_bufs[salt_pos].salt_buf[3];
277   salt_buf[4] = salt_bufs[salt_pos].salt_buf[4];
278
279   const u32 salt_len = salt_bufs[salt_pos].salt_len;
280
281   const u32 pw_salt_len = pw_len + salt_len;
282
283   u32 s0[4];
284
285   s0[0] = salt_buf[0];
286   s0[1] = salt_buf[1];
287   s0[2] = salt_buf[2];
288   s0[3] = salt_buf[3];
289
290   u32 s1[4];
291
292   s1[0] = 0x80;
293   s1[1] = 0;
294   s1[2] = 0;
295   s1[3] = 0;
296
297   u32 s2[4];
298
299   s2[0] = 0;
300   s2[1] = 0;
301   s2[2] = 0;
302   s2[3] = 0;
303
304   u32 s3[4];
305
306   s3[0] = 0;
307   s3[1] = 0;
308   s3[2] = 0;
309   s3[3] = 0;
310
311   // move w by 1
312
313   u32x w0_t[4];
314
315   w0_t[0] = w0[0];
316   w0_t[1] = w0[1];
317   w0_t[2] = w0[2];
318   w0_t[3] = w0[3];
319
320   u32x w1_t[4];
321
322   w1_t[0] = w1[0];
323   w1_t[1] = w1[1];
324   w1_t[2] = w1[2];
325   w1_t[3] = w1[3];
326
327   u32x w2_t[4];
328
329   w2_t[0] = 0;
330   w2_t[1] = 0;
331   w2_t[2] = 0;
332   w2_t[3] = 0;
333
334   u32x w3_t[4];
335
336   w3_t[0] = 0;
337   w3_t[1] = 0;
338   w3_t[2] = 0;
339   w3_t[3] = 0;
340
341   switch_buffer_by_offset (w0_t, w1_t, w2_t, w3_t, 1);
342
343   switch_buffer_by_offset (s0, s1, s2, s3, 1 + pw_len);
344
345   w0_t[0] |= s0[0];
346   w0_t[1] |= s0[1];
347   w0_t[2] |= s0[2];
348   w0_t[3] |= s0[3];
349
350   w1_t[0] |= s1[0];
351   w1_t[1] |= s1[1];
352   w1_t[2] |= s1[2];
353   w1_t[3] |= s1[3];
354
355   w2_t[0] |= s2[0];
356   w2_t[1] |= s2[1];
357   w2_t[2] |= s2[2];
358   w2_t[3] |= s2[3];
359
360   w3_t[0] |= s3[0];
361   w3_t[1] |= s3[1];
362   w3_t[2]  = pw_salt_len * 8;
363   w3_t[3]  = 0;
364
365   /**
366    * add id byte
367    */
368
369   w0_t[0] |= salt_buf[4];
370
371   /**
372    * digest
373    */
374
375   const u32 search[4] =
376   {
377     digests_buf[digests_offset].digest_buf[DGST_R0],
378     digests_buf[digests_offset].digest_buf[DGST_R1],
379     digests_buf[digests_offset].digest_buf[DGST_R2],
380     digests_buf[digests_offset].digest_buf[DGST_R3]
381   };
382
383   /**
384    * loop
385    */
386
387   u32x w0l = w0_t[0];
388   u32x w1l = w0_t[1];
389
390   for (u32 il_pos = 0; il_pos < bfs_cnt; il_pos++)
391   {
392     const u32 w0r = c_bfs[il_pos].i;
393
394     w0_t[0] = w0l | (w0r <<  8);
395     w0_t[1] = w1l | (w0r >> 24);
396
397     /**
398      * md5
399      */
400
401     u32x a = MD5M_A;
402     u32x b = MD5M_B;
403     u32x c = MD5M_C;
404     u32x d = MD5M_D;
405
406     MD5_STEP (MD5_Fo, a, b, c, d, w0_t[0], MD5C00, MD5S00);
407     MD5_STEP (MD5_Fo, d, a, b, c, w0_t[1], MD5C01, MD5S01);
408     MD5_STEP (MD5_Fo, c, d, a, b, w0_t[2], MD5C02, MD5S02);
409     MD5_STEP (MD5_Fo, b, c, d, a, w0_t[3], MD5C03, MD5S03);
410     MD5_STEP (MD5_Fo, a, b, c, d, w1_t[0], MD5C04, MD5S00);
411     MD5_STEP (MD5_Fo, d, a, b, c, w1_t[1], MD5C05, MD5S01);
412     MD5_STEP (MD5_Fo, c, d, a, b, w1_t[2], MD5C06, MD5S02);
413     MD5_STEP (MD5_Fo, b, c, d, a, w1_t[3], MD5C07, MD5S03);
414     MD5_STEP (MD5_Fo, a, b, c, d, w2_t[0], MD5C08, MD5S00);
415     MD5_STEP (MD5_Fo, d, a, b, c, w2_t[1], MD5C09, MD5S01);
416     MD5_STEP (MD5_Fo, c, d, a, b, w2_t[2], MD5C0a, MD5S02);
417     MD5_STEP (MD5_Fo, b, c, d, a, w2_t[3], MD5C0b, MD5S03);
418     MD5_STEP (MD5_Fo, a, b, c, d, w3_t[0], MD5C0c, MD5S00);
419     MD5_STEP (MD5_Fo, d, a, b, c, w3_t[1], MD5C0d, MD5S01);
420     MD5_STEP (MD5_Fo, c, d, a, b, w3_t[2], MD5C0e, MD5S02);
421     MD5_STEP (MD5_Fo, b, c, d, a, w3_t[3], MD5C0f, MD5S03);
422
423     MD5_STEP (MD5_Go, a, b, c, d, w0_t[1], MD5C10, MD5S10);
424     MD5_STEP (MD5_Go, d, a, b, c, w1_t[2], MD5C11, MD5S11);
425     MD5_STEP (MD5_Go, c, d, a, b, w2_t[3], MD5C12, MD5S12);
426     MD5_STEP (MD5_Go, b, c, d, a, w0_t[0], MD5C13, MD5S13);
427     MD5_STEP (MD5_Go, a, b, c, d, w1_t[1], MD5C14, MD5S10);
428     MD5_STEP (MD5_Go, d, a, b, c, w2_t[2], MD5C15, MD5S11);
429     MD5_STEP (MD5_Go, c, d, a, b, w3_t[3], MD5C16, MD5S12);
430     MD5_STEP (MD5_Go, b, c, d, a, w1_t[0], MD5C17, MD5S13);
431     MD5_STEP (MD5_Go, a, b, c, d, w2_t[1], MD5C18, MD5S10);
432     MD5_STEP (MD5_Go, d, a, b, c, w3_t[2], MD5C19, MD5S11);
433     MD5_STEP (MD5_Go, c, d, a, b, w0_t[3], MD5C1a, MD5S12);
434     MD5_STEP (MD5_Go, b, c, d, a, w2_t[0], MD5C1b, MD5S13);
435     MD5_STEP (MD5_Go, a, b, c, d, w3_t[1], MD5C1c, MD5S10);
436     MD5_STEP (MD5_Go, d, a, b, c, w0_t[2], MD5C1d, MD5S11);
437     MD5_STEP (MD5_Go, c, d, a, b, w1_t[3], MD5C1e, MD5S12);
438     MD5_STEP (MD5_Go, b, c, d, a, w3_t[0], MD5C1f, MD5S13);
439
440     MD5_STEP (MD5_H , a, b, c, d, w1_t[1], MD5C20, MD5S20);
441     MD5_STEP (MD5_H , d, a, b, c, w2_t[0], MD5C21, MD5S21);
442     MD5_STEP (MD5_H , c, d, a, b, w2_t[3], MD5C22, MD5S22);
443     MD5_STEP (MD5_H , b, c, d, a, w3_t[2], MD5C23, MD5S23);
444     MD5_STEP (MD5_H , a, b, c, d, w0_t[1], MD5C24, MD5S20);
445     MD5_STEP (MD5_H , d, a, b, c, w1_t[0], MD5C25, MD5S21);
446     MD5_STEP (MD5_H , c, d, a, b, w1_t[3], MD5C26, MD5S22);
447     MD5_STEP (MD5_H , b, c, d, a, w2_t[2], MD5C27, MD5S23);
448     MD5_STEP (MD5_H , a, b, c, d, w3_t[1], MD5C28, MD5S20);
449     MD5_STEP (MD5_H , d, a, b, c, w0_t[0], MD5C29, MD5S21);
450     MD5_STEP (MD5_H , c, d, a, b, w0_t[3], MD5C2a, MD5S22);
451     MD5_STEP (MD5_H , b, c, d, a, w1_t[2], MD5C2b, MD5S23);
452     MD5_STEP (MD5_H , a, b, c, d, w2_t[1], MD5C2c, MD5S20);
453     MD5_STEP (MD5_H , d, a, b, c, w3_t[0], MD5C2d, MD5S21);
454     MD5_STEP (MD5_H , c, d, a, b, w3_t[3], MD5C2e, MD5S22);
455     MD5_STEP (MD5_H , b, c, d, a, w0_t[2], MD5C2f, MD5S23);
456
457     MD5_STEP (MD5_I , a, b, c, d, w0_t[0], MD5C30, MD5S30);
458     MD5_STEP (MD5_I , d, a, b, c, w1_t[3], MD5C31, MD5S31);
459     MD5_STEP (MD5_I , c, d, a, b, w3_t[2], MD5C32, MD5S32);
460     MD5_STEP (MD5_I , b, c, d, a, w1_t[1], MD5C33, MD5S33);
461     MD5_STEP (MD5_I , a, b, c, d, w3_t[0], MD5C34, MD5S30);
462     MD5_STEP (MD5_I , d, a, b, c, w0_t[3], MD5C35, MD5S31);
463     MD5_STEP (MD5_I , c, d, a, b, w2_t[2], MD5C36, MD5S32);
464     MD5_STEP (MD5_I , b, c, d, a, w0_t[1], MD5C37, MD5S33);
465     MD5_STEP (MD5_I , a, b, c, d, w2_t[0], MD5C38, MD5S30);
466     MD5_STEP (MD5_I , d, a, b, c, w3_t[3], MD5C39, MD5S31);
467     MD5_STEP (MD5_I , c, d, a, b, w1_t[2], MD5C3a, MD5S32);
468     MD5_STEP (MD5_I , b, c, d, a, w3_t[1], MD5C3b, MD5S33);
469     MD5_STEP (MD5_I , a, b, c, d, w1_t[0], MD5C3c, MD5S30);
470
471     bool q_cond = (search[0] != a);
472
473     if (q_cond) continue;
474
475     MD5_STEP (MD5_I , d, a, b, c, w2_t[3], MD5C3d, MD5S31);
476     MD5_STEP (MD5_I , c, d, a, b, w0_t[2], MD5C3e, MD5S32);
477     MD5_STEP (MD5_I , b, c, d, a, w2_t[1], MD5C3f, MD5S33);
478
479     const u32x r0 = a;
480     const u32x r1 = d;
481     const u32x r2 = c;
482     const u32x r3 = b;
483
484     #include VECT_COMPARE_S
485   }
486 }
487
488 extern "C" __global__ void __launch_bounds__ (256, 1) m04800_m04 (const pw_t *pws, const gpu_rule_t *rules_buf, const comb_t *combs_buf, const bf_t *bfs_buf, const void *tmps, void *hooks, const u32 *bitmaps_buf_s1_a, const u32 *bitmaps_buf_s1_b, const u32 *bitmaps_buf_s1_c, const u32 *bitmaps_buf_s1_d, const u32 *bitmaps_buf_s2_a, const u32 *bitmaps_buf_s2_b, const u32 *bitmaps_buf_s2_c, const u32 *bitmaps_buf_s2_d, plain_t *plains_buf, const digest_t *digests_buf, u32 *hashes_shown, const salt_t *salt_bufs, const void *esalt_bufs, u32 *d_return_buf, u32 *d_scryptV_buf, const u32 bitmap_mask, const u32 bitmap_shift1, const u32 bitmap_shift2, const u32 salt_pos, const u32 loop_pos, const u32 loop_cnt, const u32 bfs_cnt, const u32 digests_cnt, const u32 digests_offset, const u32 combs_mode, const u32 gid_max)
489 {
490   /**
491    * base
492    */
493
494   const u32 gid = (blockIdx.x * blockDim.x) + threadIdx.x;
495
496   if (gid >= gid_max) return;
497
498
499   u32x w0[4];
500
501   w0[0] = pws[gid].i[ 0];
502   w0[1] = pws[gid].i[ 1];
503   w0[2] = pws[gid].i[ 2];
504   w0[3] = pws[gid].i[ 3];
505
506   u32x w1[4];
507
508   w1[0] = 0;
509   w1[1] = 0;
510   w1[2] = 0;
511   w1[3] = 0;
512
513   u32x w2[4];
514
515   w2[0] = 0;
516   w2[1] = 0;
517   w2[2] = 0;
518   w2[3] = 0;
519
520   u32x w3[4];
521
522   w3[0] = 0;
523   w3[1] = 0;
524   w3[2] = 0;
525   w3[3] = 0;
526
527   const u32 pw_len = pws[gid].pw_len;
528
529   /**
530    * main
531    */
532
533   m04800m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, bfs_cnt, digests_cnt, digests_offset);
534 }
535
536 extern "C" __global__ void __launch_bounds__ (256, 1) m04800_m08 (const pw_t *pws, const gpu_rule_t *rules_buf, const comb_t *combs_buf, const bf_t *bfs_buf, const void *tmps, void *hooks, const u32 *bitmaps_buf_s1_a, const u32 *bitmaps_buf_s1_b, const u32 *bitmaps_buf_s1_c, const u32 *bitmaps_buf_s1_d, const u32 *bitmaps_buf_s2_a, const u32 *bitmaps_buf_s2_b, const u32 *bitmaps_buf_s2_c, const u32 *bitmaps_buf_s2_d, plain_t *plains_buf, const digest_t *digests_buf, u32 *hashes_shown, const salt_t *salt_bufs, const void *esalt_bufs, u32 *d_return_buf, u32 *d_scryptV_buf, const u32 bitmap_mask, const u32 bitmap_shift1, const u32 bitmap_shift2, const u32 salt_pos, const u32 loop_pos, const u32 loop_cnt, const u32 bfs_cnt, const u32 digests_cnt, const u32 digests_offset, const u32 combs_mode, const u32 gid_max)
537 {
538   /**
539    * base
540    */
541
542   const u32 gid = (blockIdx.x * blockDim.x) + threadIdx.x;
543
544   if (gid >= gid_max) return;
545
546
547   u32x w0[4];
548
549   w0[0] = pws[gid].i[ 0];
550   w0[1] = pws[gid].i[ 1];
551   w0[2] = pws[gid].i[ 2];
552   w0[3] = pws[gid].i[ 3];
553
554   u32x w1[4];
555
556   w1[0] = pws[gid].i[ 4];
557   w1[1] = pws[gid].i[ 5];
558   w1[2] = pws[gid].i[ 6];
559   w1[3] = pws[gid].i[ 7];
560
561   u32x w2[4];
562
563   w2[0] = 0;
564   w2[1] = 0;
565   w2[2] = 0;
566   w2[3] = 0;
567
568   u32x w3[4];
569
570   w3[0] = 0;
571   w3[1] = 0;
572   w3[2] = 0;
573   w3[3] = 0;
574
575   const u32 pw_len = pws[gid].pw_len;
576
577   /**
578    * main
579    */
580
581   m04800m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, bfs_cnt, digests_cnt, digests_offset);
582 }
583
584 extern "C" __global__ void __launch_bounds__ (256, 1) m04800_m16 (const pw_t *pws, const gpu_rule_t *rules_buf, const comb_t *combs_buf, const bf_t *bfs_buf, const void *tmps, void *hooks, const u32 *bitmaps_buf_s1_a, const u32 *bitmaps_buf_s1_b, const u32 *bitmaps_buf_s1_c, const u32 *bitmaps_buf_s1_d, const u32 *bitmaps_buf_s2_a, const u32 *bitmaps_buf_s2_b, const u32 *bitmaps_buf_s2_c, const u32 *bitmaps_buf_s2_d, plain_t *plains_buf, const digest_t *digests_buf, u32 *hashes_shown, const salt_t *salt_bufs, const void *esalt_bufs, u32 *d_return_buf, u32 *d_scryptV_buf, const u32 bitmap_mask, const u32 bitmap_shift1, const u32 bitmap_shift2, const u32 salt_pos, const u32 loop_pos, const u32 loop_cnt, const u32 bfs_cnt, const u32 digests_cnt, const u32 digests_offset, const u32 combs_mode, const u32 gid_max)
585 {
586   /**
587    * base
588    */
589
590   const u32 gid = (blockIdx.x * blockDim.x) + threadIdx.x;
591
592   if (gid >= gid_max) return;
593
594
595   u32x w0[4];
596
597   w0[0] = pws[gid].i[ 0];
598   w0[1] = pws[gid].i[ 1];
599   w0[2] = pws[gid].i[ 2];
600   w0[3] = pws[gid].i[ 3];
601
602   u32x w1[4];
603
604   w1[0] = pws[gid].i[ 4];
605   w1[1] = pws[gid].i[ 5];
606   w1[2] = pws[gid].i[ 6];
607   w1[3] = pws[gid].i[ 7];
608
609   u32x w2[4];
610
611   w2[0] = pws[gid].i[ 8];
612   w2[1] = pws[gid].i[ 9];
613   w2[2] = pws[gid].i[10];
614   w2[3] = pws[gid].i[11];
615
616   u32x w3[4];
617
618   w3[0] = pws[gid].i[12];
619   w3[1] = pws[gid].i[13];
620   w3[2] = pws[gid].i[14];
621   w3[3] = pws[gid].i[15];
622
623   const u32 pw_len = pws[gid].pw_len;
624
625   /**
626    * main
627    */
628
629   m04800m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, bfs_cnt, digests_cnt, digests_offset);
630 }
631
632 extern "C" __global__ void __launch_bounds__ (256, 1) m04800_s04 (const pw_t *pws, const gpu_rule_t *rules_buf, const comb_t *combs_buf, const bf_t *bfs_buf, const void *tmps, void *hooks, const u32 *bitmaps_buf_s1_a, const u32 *bitmaps_buf_s1_b, const u32 *bitmaps_buf_s1_c, const u32 *bitmaps_buf_s1_d, const u32 *bitmaps_buf_s2_a, const u32 *bitmaps_buf_s2_b, const u32 *bitmaps_buf_s2_c, const u32 *bitmaps_buf_s2_d, plain_t *plains_buf, const digest_t *digests_buf, u32 *hashes_shown, const salt_t *salt_bufs, const void *esalt_bufs, u32 *d_return_buf, u32 *d_scryptV_buf, const u32 bitmap_mask, const u32 bitmap_shift1, const u32 bitmap_shift2, const u32 salt_pos, const u32 loop_pos, const u32 loop_cnt, const u32 bfs_cnt, const u32 digests_cnt, const u32 digests_offset, const u32 combs_mode, const u32 gid_max)
633 {
634   /**
635    * base
636    */
637
638   const u32 gid = (blockIdx.x * blockDim.x) + threadIdx.x;
639
640   if (gid >= gid_max) return;
641
642   u32x w0[4];
643
644   w0[0] = pws[gid].i[ 0];
645   w0[1] = pws[gid].i[ 1];
646   w0[2] = pws[gid].i[ 2];
647   w0[3] = pws[gid].i[ 3];
648
649   u32x w1[4];
650
651   w1[0] = 0;
652   w1[1] = 0;
653   w1[2] = 0;
654   w1[3] = 0;
655
656   u32x w2[4];
657
658   w2[0] = 0;
659   w2[1] = 0;
660   w2[2] = 0;
661   w2[3] = 0;
662
663   u32x w3[4];
664
665   w3[0] = 0;
666   w3[1] = 0;
667   w3[2] = 0;
668   w3[3] = 0;
669
670   const u32 pw_len = pws[gid].pw_len;
671
672   /**
673    * main
674    */
675
676   m04800s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, bfs_cnt, digests_cnt, digests_offset);
677 }
678
679 extern "C" __global__ void __launch_bounds__ (256, 1) m04800_s08 (const pw_t *pws, const gpu_rule_t *rules_buf, const comb_t *combs_buf, const bf_t *bfs_buf, const void *tmps, void *hooks, const u32 *bitmaps_buf_s1_a, const u32 *bitmaps_buf_s1_b, const u32 *bitmaps_buf_s1_c, const u32 *bitmaps_buf_s1_d, const u32 *bitmaps_buf_s2_a, const u32 *bitmaps_buf_s2_b, const u32 *bitmaps_buf_s2_c, const u32 *bitmaps_buf_s2_d, plain_t *plains_buf, const digest_t *digests_buf, u32 *hashes_shown, const salt_t *salt_bufs, const void *esalt_bufs, u32 *d_return_buf, u32 *d_scryptV_buf, const u32 bitmap_mask, const u32 bitmap_shift1, const u32 bitmap_shift2, const u32 salt_pos, const u32 loop_pos, const u32 loop_cnt, const u32 bfs_cnt, const u32 digests_cnt, const u32 digests_offset, const u32 combs_mode, const u32 gid_max)
680 {
681   /**
682    * base
683    */
684
685   const u32 gid = (blockIdx.x * blockDim.x) + threadIdx.x;
686
687   if (gid >= gid_max) return;
688
689
690   u32x w0[4];
691
692   w0[0] = pws[gid].i[ 0];
693   w0[1] = pws[gid].i[ 1];
694   w0[2] = pws[gid].i[ 2];
695   w0[3] = pws[gid].i[ 3];
696
697   u32x w1[4];
698
699   w1[0] = pws[gid].i[ 4];
700   w1[1] = pws[gid].i[ 5];
701   w1[2] = pws[gid].i[ 6];
702   w1[3] = pws[gid].i[ 7];
703
704   u32x w2[4];
705
706   w2[0] = 0;
707   w2[1] = 0;
708   w2[2] = 0;
709   w2[3] = 0;
710
711   u32x w3[4];
712
713   w3[0] = 0;
714   w3[1] = 0;
715   w3[2] = 0;
716   w3[3] = 0;
717
718   const u32 pw_len = pws[gid].pw_len;
719
720   /**
721    * main
722    */
723
724   m04800s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, bfs_cnt, digests_cnt, digests_offset);
725 }
726
727 extern "C" __global__ void __launch_bounds__ (256, 1) m04800_s16 (const pw_t *pws, const gpu_rule_t *rules_buf, const comb_t *combs_buf, const bf_t *bfs_buf, const void *tmps, void *hooks, const u32 *bitmaps_buf_s1_a, const u32 *bitmaps_buf_s1_b, const u32 *bitmaps_buf_s1_c, const u32 *bitmaps_buf_s1_d, const u32 *bitmaps_buf_s2_a, const u32 *bitmaps_buf_s2_b, const u32 *bitmaps_buf_s2_c, const u32 *bitmaps_buf_s2_d, plain_t *plains_buf, const digest_t *digests_buf, u32 *hashes_shown, const salt_t *salt_bufs, const void *esalt_bufs, u32 *d_return_buf, u32 *d_scryptV_buf, const u32 bitmap_mask, const u32 bitmap_shift1, const u32 bitmap_shift2, const u32 salt_pos, const u32 loop_pos, const u32 loop_cnt, const u32 bfs_cnt, const u32 digests_cnt, const u32 digests_offset, const u32 combs_mode, const u32 gid_max)
728 {
729   /**
730    * base
731    */
732
733   const u32 gid = (blockIdx.x * blockDim.x) + threadIdx.x;
734
735   if (gid >= gid_max) return;
736
737
738   u32x w0[4];
739
740   w0[0] = pws[gid].i[ 0];
741   w0[1] = pws[gid].i[ 1];
742   w0[2] = pws[gid].i[ 2];
743   w0[3] = pws[gid].i[ 3];
744
745   u32x w1[4];
746
747   w1[0] = pws[gid].i[ 4];
748   w1[1] = pws[gid].i[ 5];
749   w1[2] = pws[gid].i[ 6];
750   w1[3] = pws[gid].i[ 7];
751
752   u32x w2[4];
753
754   w2[0] = pws[gid].i[ 8];
755   w2[1] = pws[gid].i[ 9];
756   w2[2] = pws[gid].i[10];
757   w2[3] = pws[gid].i[11];
758
759   u32x w3[4];
760
761   w3[0] = pws[gid].i[12];
762   w3[1] = pws[gid].i[13];
763   w3[2] = pws[gid].i[14];
764   w3[3] = pws[gid].i[15];
765
766   const u32 pw_len = pws[gid].pw_len;
767
768   /**
769    * main
770    */
771
772   m04800s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, bfs_cnt, digests_cnt, digests_offset);
773 }