Initial commit
[hashcat.git] / nv / m02710_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 #ifdef VECT_SIZE1
46 #define uint_to_hex_lower8(i) l_bin2asc[(i)]
47 #endif
48
49 #ifdef VECT_SIZE2
50 #define uint_to_hex_lower8(i) u32x (l_bin2asc[(i).x], l_bin2asc[(i).y])
51 #endif
52
53 #ifdef VECT_SIZE4
54 #define uint_to_hex_lower8(i) u32x (l_bin2asc[(i).x], l_bin2asc[(i).y], l_bin2asc[(i).z], l_bin2asc[(i).w])
55 #endif
56
57 __device__ __constant__ char c_bin2asc[16] = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f' };
58
59 __device__ __shared__ short l_bin2asc[256];
60
61 __device__ static void m02710m (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)
62 {
63   /**
64    * modifier
65    */
66
67   const u32 gid = (blockIdx.x * blockDim.x) + threadIdx.x;
68   const u32 lid = threadIdx.x;
69
70   /**
71    * salt
72    */
73
74   u32 s[8];
75
76   s[0] = salt_bufs[salt_pos].salt_buf[0];
77   s[1] = salt_bufs[salt_pos].salt_buf[1];
78   s[2] = salt_bufs[salt_pos].salt_buf[2];
79   s[3] = salt_bufs[salt_pos].salt_buf[3];
80   s[4] = salt_bufs[salt_pos].salt_buf[4];
81   s[5] = salt_bufs[salt_pos].salt_buf[5];
82   s[6] = salt_bufs[salt_pos].salt_buf[6];
83   s[7] = salt_bufs[salt_pos].salt_buf[7];
84
85   const u32 salt_len = salt_bufs[salt_pos].salt_len;
86
87   const u32 r_14 = (32 + salt_len) * 8;
88
89   /**
90    * loop
91    */
92
93   u32x w0l = w0[0];
94
95   for (u32 il_pos = 0; il_pos < bfs_cnt; il_pos++)
96   {
97     const u32 w0r = c_bfs[il_pos].i;
98
99     w0[0] = w0l | w0r;
100
101     u32x a = MD5M_A;
102     u32x b = MD5M_B;
103     u32x c = MD5M_C;
104     u32x d = MD5M_D;
105
106     MD5_STEP (MD5_Fo, a, b, c, d, w0[0], MD5C00, MD5S00);
107     MD5_STEP (MD5_Fo, d, a, b, c, w0[1], MD5C01, MD5S01);
108     MD5_STEP (MD5_Fo, c, d, a, b, w0[2], MD5C02, MD5S02);
109     MD5_STEP (MD5_Fo, b, c, d, a, w0[3], MD5C03, MD5S03);
110     MD5_STEP (MD5_Fo, a, b, c, d, w1[0], MD5C04, MD5S00);
111     MD5_STEP (MD5_Fo, d, a, b, c, w1[1], MD5C05, MD5S01);
112     MD5_STEP (MD5_Fo, c, d, a, b, w1[2], MD5C06, MD5S02);
113     MD5_STEP (MD5_Fo, b, c, d, a, w1[3], MD5C07, MD5S03);
114     MD5_STEP (MD5_Fo, a, b, c, d, w2[0], MD5C08, MD5S00);
115     MD5_STEP (MD5_Fo, d, a, b, c, w2[1], MD5C09, MD5S01);
116     MD5_STEP (MD5_Fo, c, d, a, b, w2[2], MD5C0a, MD5S02);
117     MD5_STEP (MD5_Fo, b, c, d, a, w2[3], MD5C0b, MD5S03);
118     MD5_STEP (MD5_Fo, a, b, c, d, w3[0], MD5C0c, MD5S00);
119     MD5_STEP (MD5_Fo, d, a, b, c, w3[1], MD5C0d, MD5S01);
120     MD5_STEP (MD5_Fo, c, d, a, b, w3[2], MD5C0e, MD5S02);
121     MD5_STEP (MD5_Fo, b, c, d, a, w3[3], MD5C0f, MD5S03);
122
123     MD5_STEP (MD5_Go, a, b, c, d, w0[1], MD5C10, MD5S10);
124     MD5_STEP (MD5_Go, d, a, b, c, w1[2], MD5C11, MD5S11);
125     MD5_STEP (MD5_Go, c, d, a, b, w2[3], MD5C12, MD5S12);
126     MD5_STEP (MD5_Go, b, c, d, a, w0[0], MD5C13, MD5S13);
127     MD5_STEP (MD5_Go, a, b, c, d, w1[1], MD5C14, MD5S10);
128     MD5_STEP (MD5_Go, d, a, b, c, w2[2], MD5C15, MD5S11);
129     MD5_STEP (MD5_Go, c, d, a, b, w3[3], MD5C16, MD5S12);
130     MD5_STEP (MD5_Go, b, c, d, a, w1[0], MD5C17, MD5S13);
131     MD5_STEP (MD5_Go, a, b, c, d, w2[1], MD5C18, MD5S10);
132     MD5_STEP (MD5_Go, d, a, b, c, w3[2], MD5C19, MD5S11);
133     MD5_STEP (MD5_Go, c, d, a, b, w0[3], MD5C1a, MD5S12);
134     MD5_STEP (MD5_Go, b, c, d, a, w2[0], MD5C1b, MD5S13);
135     MD5_STEP (MD5_Go, a, b, c, d, w3[1], MD5C1c, MD5S10);
136     MD5_STEP (MD5_Go, d, a, b, c, w0[2], MD5C1d, MD5S11);
137     MD5_STEP (MD5_Go, c, d, a, b, w1[3], MD5C1e, MD5S12);
138     MD5_STEP (MD5_Go, b, c, d, a, w3[0], MD5C1f, MD5S13);
139
140     MD5_STEP (MD5_H , a, b, c, d, w1[1], MD5C20, MD5S20);
141     MD5_STEP (MD5_H , d, a, b, c, w2[0], MD5C21, MD5S21);
142     MD5_STEP (MD5_H , c, d, a, b, w2[3], MD5C22, MD5S22);
143     MD5_STEP (MD5_H , b, c, d, a, w3[2], MD5C23, MD5S23);
144     MD5_STEP (MD5_H , a, b, c, d, w0[1], MD5C24, MD5S20);
145     MD5_STEP (MD5_H , d, a, b, c, w1[0], MD5C25, MD5S21);
146     MD5_STEP (MD5_H , c, d, a, b, w1[3], MD5C26, MD5S22);
147     MD5_STEP (MD5_H , b, c, d, a, w2[2], MD5C27, MD5S23);
148     MD5_STEP (MD5_H , a, b, c, d, w3[1], MD5C28, MD5S20);
149     MD5_STEP (MD5_H , d, a, b, c, w0[0], MD5C29, MD5S21);
150     MD5_STEP (MD5_H , c, d, a, b, w0[3], MD5C2a, MD5S22);
151     MD5_STEP (MD5_H , b, c, d, a, w1[2], MD5C2b, MD5S23);
152     MD5_STEP (MD5_H , a, b, c, d, w2[1], MD5C2c, MD5S20);
153     MD5_STEP (MD5_H , d, a, b, c, w3[0], MD5C2d, MD5S21);
154     MD5_STEP (MD5_H , c, d, a, b, w3[3], MD5C2e, MD5S22);
155     MD5_STEP (MD5_H , b, c, d, a, w0[2], MD5C2f, MD5S23);
156
157     MD5_STEP (MD5_I , a, b, c, d, w0[0], MD5C30, MD5S30);
158     MD5_STEP (MD5_I , d, a, b, c, w1[3], MD5C31, MD5S31);
159     MD5_STEP (MD5_I , c, d, a, b, w3[2], MD5C32, MD5S32);
160     MD5_STEP (MD5_I , b, c, d, a, w1[1], MD5C33, MD5S33);
161     MD5_STEP (MD5_I , a, b, c, d, w3[0], MD5C34, MD5S30);
162     MD5_STEP (MD5_I , d, a, b, c, w0[3], MD5C35, MD5S31);
163     MD5_STEP (MD5_I , c, d, a, b, w2[2], MD5C36, MD5S32);
164     MD5_STEP (MD5_I , b, c, d, a, w0[1], MD5C37, MD5S33);
165     MD5_STEP (MD5_I , a, b, c, d, w2[0], MD5C38, MD5S30);
166     MD5_STEP (MD5_I , d, a, b, c, w3[3], MD5C39, MD5S31);
167     MD5_STEP (MD5_I , c, d, a, b, w1[2], MD5C3a, MD5S32);
168     MD5_STEP (MD5_I , b, c, d, a, w3[1], MD5C3b, MD5S33);
169     MD5_STEP (MD5_I , a, b, c, d, w1[0], MD5C3c, MD5S30);
170     MD5_STEP (MD5_I , d, a, b, c, w2[3], MD5C3d, MD5S31);
171     MD5_STEP (MD5_I , c, d, a, b, w0[2], MD5C3e, MD5S32);
172     MD5_STEP (MD5_I , b, c, d, a, w2[1], MD5C3f, MD5S33);
173
174     a += MD5M_A;
175     b += MD5M_B;
176     c += MD5M_C;
177     d += MD5M_D;
178
179     const u32x w0_t = uint_to_hex_lower8 ((a >>  0) & 255) <<  0
180                      | uint_to_hex_lower8 ((a >>  8) & 255) << 16;
181     const u32x w1_t = uint_to_hex_lower8 ((a >> 16) & 255) <<  0
182                      | uint_to_hex_lower8 ((a >> 24) & 255) << 16;
183     const u32x w2_t = uint_to_hex_lower8 ((b >>  0) & 255) <<  0
184                      | uint_to_hex_lower8 ((b >>  8) & 255) << 16;
185     const u32x w3_t = uint_to_hex_lower8 ((b >> 16) & 255) <<  0
186                      | uint_to_hex_lower8 ((b >> 24) & 255) << 16;
187     const u32x w4_t = uint_to_hex_lower8 ((c >>  0) & 255) <<  0
188                      | uint_to_hex_lower8 ((c >>  8) & 255) << 16;
189     const u32x w5_t = uint_to_hex_lower8 ((c >> 16) & 255) <<  0
190                      | uint_to_hex_lower8 ((c >> 24) & 255) << 16;
191     const u32x w6_t = uint_to_hex_lower8 ((d >>  0) & 255) <<  0
192                      | uint_to_hex_lower8 ((d >>  8) & 255) << 16;
193     const u32x w7_t = uint_to_hex_lower8 ((d >> 16) & 255) <<  0
194                      | uint_to_hex_lower8 ((d >> 24) & 255) << 16;
195
196     const u32 w8_t = s[0];
197     const u32 w9_t = s[1];
198     const u32 wa_t = s[2];
199     const u32 wb_t = s[3];
200     const u32 wc_t = s[4];
201     const u32 wd_t = s[5];
202     const u32 we_t = s[6];
203     const u32 wf_t = s[7];
204
205     a = MD5M_A;
206     b = MD5M_B;
207     c = MD5M_C;
208     d = MD5M_D;
209
210     MD5_STEP (MD5_Fo, a, b, c, d, w0_t, MD5C00, MD5S00);
211     MD5_STEP (MD5_Fo, d, a, b, c, w1_t, MD5C01, MD5S01);
212     MD5_STEP (MD5_Fo, c, d, a, b, w2_t, MD5C02, MD5S02);
213     MD5_STEP (MD5_Fo, b, c, d, a, w3_t, MD5C03, MD5S03);
214     MD5_STEP (MD5_Fo, a, b, c, d, w4_t, MD5C04, MD5S00);
215     MD5_STEP (MD5_Fo, d, a, b, c, w5_t, MD5C05, MD5S01);
216     MD5_STEP (MD5_Fo, c, d, a, b, w6_t, MD5C06, MD5S02);
217     MD5_STEP (MD5_Fo, b, c, d, a, w7_t, MD5C07, MD5S03);
218     MD5_STEP (MD5_Fo, a, b, c, d, w8_t, MD5C08, MD5S00);
219     MD5_STEP (MD5_Fo, d, a, b, c, w9_t, MD5C09, MD5S01);
220     MD5_STEP (MD5_Fo, c, d, a, b, wa_t, MD5C0a, MD5S02);
221     MD5_STEP (MD5_Fo, b, c, d, a, wb_t, MD5C0b, MD5S03);
222     MD5_STEP (MD5_Fo, a, b, c, d, wc_t, MD5C0c, MD5S00);
223     MD5_STEP (MD5_Fo, d, a, b, c, wd_t, MD5C0d, MD5S01);
224     MD5_STEP (MD5_Fo, c, d, a, b, we_t, MD5C0e, MD5S02);
225     MD5_STEP (MD5_Fo, b, c, d, a, wf_t, MD5C0f, MD5S03);
226
227     MD5_STEP (MD5_Go, a, b, c, d, w1_t, MD5C10, MD5S10);
228     MD5_STEP (MD5_Go, d, a, b, c, w6_t, MD5C11, MD5S11);
229     MD5_STEP (MD5_Go, c, d, a, b, wb_t, MD5C12, MD5S12);
230     MD5_STEP (MD5_Go, b, c, d, a, w0_t, MD5C13, MD5S13);
231     MD5_STEP (MD5_Go, a, b, c, d, w5_t, MD5C14, MD5S10);
232     MD5_STEP (MD5_Go, d, a, b, c, wa_t, MD5C15, MD5S11);
233     MD5_STEP (MD5_Go, c, d, a, b, wf_t, MD5C16, MD5S12);
234     MD5_STEP (MD5_Go, b, c, d, a, w4_t, MD5C17, MD5S13);
235     MD5_STEP (MD5_Go, a, b, c, d, w9_t, MD5C18, MD5S10);
236     MD5_STEP (MD5_Go, d, a, b, c, we_t, MD5C19, MD5S11);
237     MD5_STEP (MD5_Go, c, d, a, b, w3_t, MD5C1a, MD5S12);
238     MD5_STEP (MD5_Go, b, c, d, a, w8_t, MD5C1b, MD5S13);
239     MD5_STEP (MD5_Go, a, b, c, d, wd_t, MD5C1c, MD5S10);
240     MD5_STEP (MD5_Go, d, a, b, c, w2_t, MD5C1d, MD5S11);
241     MD5_STEP (MD5_Go, c, d, a, b, w7_t, MD5C1e, MD5S12);
242     MD5_STEP (MD5_Go, b, c, d, a, wc_t, MD5C1f, MD5S13);
243
244     MD5_STEP (MD5_H , a, b, c, d, w5_t, MD5C20, MD5S20);
245     MD5_STEP (MD5_H , d, a, b, c, w8_t, MD5C21, MD5S21);
246     MD5_STEP (MD5_H , c, d, a, b, wb_t, MD5C22, MD5S22);
247     MD5_STEP (MD5_H , b, c, d, a, we_t, MD5C23, MD5S23);
248     MD5_STEP (MD5_H , a, b, c, d, w1_t, MD5C24, MD5S20);
249     MD5_STEP (MD5_H , d, a, b, c, w4_t, MD5C25, MD5S21);
250     MD5_STEP (MD5_H , c, d, a, b, w7_t, MD5C26, MD5S22);
251     MD5_STEP (MD5_H , b, c, d, a, wa_t, MD5C27, MD5S23);
252     MD5_STEP (MD5_H , a, b, c, d, wd_t, MD5C28, MD5S20);
253     MD5_STEP (MD5_H , d, a, b, c, w0_t, MD5C29, MD5S21);
254     MD5_STEP (MD5_H , c, d, a, b, w3_t, MD5C2a, MD5S22);
255     MD5_STEP (MD5_H , b, c, d, a, w6_t, MD5C2b, MD5S23);
256     MD5_STEP (MD5_H , a, b, c, d, w9_t, MD5C2c, MD5S20);
257     MD5_STEP (MD5_H , d, a, b, c, wc_t, MD5C2d, MD5S21);
258     MD5_STEP (MD5_H , c, d, a, b, wf_t, MD5C2e, MD5S22);
259     MD5_STEP (MD5_H , b, c, d, a, w2_t, MD5C2f, MD5S23);
260
261     MD5_STEP (MD5_I , a, b, c, d, w0_t, MD5C30, MD5S30);
262     MD5_STEP (MD5_I , d, a, b, c, w7_t, MD5C31, MD5S31);
263     MD5_STEP (MD5_I , c, d, a, b, we_t, MD5C32, MD5S32);
264     MD5_STEP (MD5_I , b, c, d, a, w5_t, MD5C33, MD5S33);
265     MD5_STEP (MD5_I , a, b, c, d, wc_t, MD5C34, MD5S30);
266     MD5_STEP (MD5_I , d, a, b, c, w3_t, MD5C35, MD5S31);
267     MD5_STEP (MD5_I , c, d, a, b, wa_t, MD5C36, MD5S32);
268     MD5_STEP (MD5_I , b, c, d, a, w1_t, MD5C37, MD5S33);
269     MD5_STEP (MD5_I , a, b, c, d, w8_t, MD5C38, MD5S30);
270     MD5_STEP (MD5_I , d, a, b, c, wf_t, MD5C39, MD5S31);
271     MD5_STEP (MD5_I , c, d, a, b, w6_t, MD5C3a, MD5S32);
272     MD5_STEP (MD5_I , b, c, d, a, wd_t, MD5C3b, MD5S33);
273     MD5_STEP (MD5_I , a, b, c, d, w4_t, MD5C3c, MD5S30);
274     MD5_STEP (MD5_I , d, a, b, c, wb_t, MD5C3d, MD5S31);
275     MD5_STEP (MD5_I , c, d, a, b, w2_t, MD5C3e, MD5S32);
276     MD5_STEP (MD5_I , b, c, d, a, w9_t, MD5C3f, MD5S33);
277
278     const u32x r_a = a + MD5M_A;
279     const u32x r_b = b + MD5M_B;
280     const u32x r_c = c + MD5M_C;
281     const u32x r_d = d + MD5M_D;
282
283     a = r_a;
284     b = r_b;
285     c = r_c;
286     d = r_d;
287
288     MD5_STEP0(MD5_Fo, a, b, c, d,       MD5C00, MD5S00);
289     MD5_STEP0(MD5_Fo, d, a, b, c,       MD5C01, MD5S01);
290     MD5_STEP0(MD5_Fo, c, d, a, b,       MD5C02, MD5S02);
291     MD5_STEP0(MD5_Fo, b, c, d, a,       MD5C03, MD5S03);
292     MD5_STEP0(MD5_Fo, a, b, c, d,       MD5C04, MD5S00);
293     MD5_STEP0(MD5_Fo, d, a, b, c,       MD5C05, MD5S01);
294     MD5_STEP0(MD5_Fo, c, d, a, b,       MD5C06, MD5S02);
295     MD5_STEP0(MD5_Fo, b, c, d, a,       MD5C07, MD5S03);
296     MD5_STEP0(MD5_Fo, a, b, c, d,       MD5C08, MD5S00);
297     MD5_STEP0(MD5_Fo, d, a, b, c,       MD5C09, MD5S01);
298     MD5_STEP0(MD5_Fo, c, d, a, b,       MD5C0a, MD5S02);
299     MD5_STEP0(MD5_Fo, b, c, d, a,       MD5C0b, MD5S03);
300     MD5_STEP0(MD5_Fo, a, b, c, d,       MD5C0c, MD5S00);
301     MD5_STEP0(MD5_Fo, d, a, b, c,       MD5C0d, MD5S01);
302     MD5_STEP (MD5_Fo, c, d, a, b, r_14, MD5C0e, MD5S02);
303     MD5_STEP0(MD5_Fo, b, c, d, a,       MD5C0f, MD5S03);
304
305     MD5_STEP0(MD5_Go, a, b, c, d,       MD5C10, MD5S10);
306     MD5_STEP0(MD5_Go, d, a, b, c,       MD5C11, MD5S11);
307     MD5_STEP0(MD5_Go, c, d, a, b,       MD5C12, MD5S12);
308     MD5_STEP0(MD5_Go, b, c, d, a,       MD5C13, MD5S13);
309     MD5_STEP0(MD5_Go, a, b, c, d,       MD5C14, MD5S10);
310     MD5_STEP0(MD5_Go, d, a, b, c,       MD5C15, MD5S11);
311     MD5_STEP0(MD5_Go, c, d, a, b,       MD5C16, MD5S12);
312     MD5_STEP0(MD5_Go, b, c, d, a,       MD5C17, MD5S13);
313     MD5_STEP0(MD5_Go, a, b, c, d,       MD5C18, MD5S10);
314     MD5_STEP (MD5_Go, d, a, b, c, r_14, MD5C19, MD5S11);
315     MD5_STEP0(MD5_Go, c, d, a, b,       MD5C1a, MD5S12);
316     MD5_STEP0(MD5_Go, b, c, d, a,       MD5C1b, MD5S13);
317     MD5_STEP0(MD5_Go, a, b, c, d,       MD5C1c, MD5S10);
318     MD5_STEP0(MD5_Go, d, a, b, c,       MD5C1d, MD5S11);
319     MD5_STEP0(MD5_Go, c, d, a, b,       MD5C1e, MD5S12);
320     MD5_STEP0(MD5_Go, b, c, d, a,       MD5C1f, MD5S13);
321
322     MD5_STEP0(MD5_H , a, b, c, d,       MD5C20, MD5S20);
323     MD5_STEP0(MD5_H , d, a, b, c,       MD5C21, MD5S21);
324     MD5_STEP0(MD5_H , c, d, a, b,       MD5C22, MD5S22);
325     MD5_STEP (MD5_H , b, c, d, a, r_14, MD5C23, MD5S23);
326     MD5_STEP0(MD5_H , a, b, c, d,       MD5C24, MD5S20);
327     MD5_STEP0(MD5_H , d, a, b, c,       MD5C25, MD5S21);
328     MD5_STEP0(MD5_H , c, d, a, b,       MD5C26, MD5S22);
329     MD5_STEP0(MD5_H , b, c, d, a,       MD5C27, MD5S23);
330     MD5_STEP0(MD5_H , a, b, c, d,       MD5C28, MD5S20);
331     MD5_STEP0(MD5_H , d, a, b, c,       MD5C29, MD5S21);
332     MD5_STEP0(MD5_H , c, d, a, b,       MD5C2a, MD5S22);
333     MD5_STEP0(MD5_H , b, c, d, a,       MD5C2b, MD5S23);
334     MD5_STEP0(MD5_H , a, b, c, d,       MD5C2c, MD5S20);
335     MD5_STEP0(MD5_H , d, a, b, c,       MD5C2d, MD5S21);
336     MD5_STEP0(MD5_H , c, d, a, b,       MD5C2e, MD5S22);
337     MD5_STEP0(MD5_H , b, c, d, a,       MD5C2f, MD5S23);
338
339     MD5_STEP0(MD5_I , a, b, c, d,       MD5C30, MD5S30);
340     MD5_STEP0(MD5_I , d, a, b, c,       MD5C31, MD5S31);
341     MD5_STEP (MD5_I , c, d, a, b, r_14, MD5C32, MD5S32);
342     MD5_STEP0(MD5_I , b, c, d, a,       MD5C33, MD5S33);
343     MD5_STEP0(MD5_I , a, b, c, d,       MD5C34, MD5S30);
344     MD5_STEP0(MD5_I , d, a, b, c,       MD5C35, MD5S31);
345     MD5_STEP0(MD5_I , c, d, a, b,       MD5C36, MD5S32);
346     MD5_STEP0(MD5_I , b, c, d, a,       MD5C37, MD5S33);
347     MD5_STEP0(MD5_I , a, b, c, d,       MD5C38, MD5S30);
348     MD5_STEP0(MD5_I , d, a, b, c,       MD5C39, MD5S31);
349     MD5_STEP0(MD5_I , c, d, a, b,       MD5C3a, MD5S32);
350     MD5_STEP0(MD5_I , b, c, d, a,       MD5C3b, MD5S33);
351     MD5_STEP0(MD5_I , a, b, c, d,       MD5C3c, MD5S30);
352     MD5_STEP0(MD5_I , d, a, b, c,       MD5C3d, MD5S31);
353     MD5_STEP0(MD5_I , c, d, a, b,       MD5C3e, MD5S32);
354     MD5_STEP0(MD5_I , b, c, d, a,       MD5C3f, MD5S33);
355
356     a += r_a;
357     b += r_b;
358     c += r_c;
359     d += r_d;
360
361     const u32x r0 = a;
362     const u32x r1 = d;
363     const u32x r2 = c;
364     const u32x r3 = b;
365
366     #include VECT_COMPARE_M
367   }
368 }
369
370 __device__ static void m02710s (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)
371 {
372   /**
373    * modifier
374    */
375
376   const u32 gid = (blockIdx.x * blockDim.x) + threadIdx.x;
377   const u32 lid = threadIdx.x;
378
379   /**
380    * digest
381    */
382
383   const u32 search[4] =
384   {
385     digests_buf[digests_offset].digest_buf[DGST_R0],
386     digests_buf[digests_offset].digest_buf[DGST_R1],
387     digests_buf[digests_offset].digest_buf[DGST_R2],
388     digests_buf[digests_offset].digest_buf[DGST_R3]
389   };
390
391   /**
392    * salt
393    */
394
395   u32 s[8];
396
397   s[0] = salt_bufs[salt_pos].salt_buf[0];
398   s[1] = salt_bufs[salt_pos].salt_buf[1];
399   s[2] = salt_bufs[salt_pos].salt_buf[2];
400   s[3] = salt_bufs[salt_pos].salt_buf[3];
401   s[4] = salt_bufs[salt_pos].salt_buf[4];
402   s[5] = salt_bufs[salt_pos].salt_buf[5];
403   s[6] = salt_bufs[salt_pos].salt_buf[6];
404   s[7] = salt_bufs[salt_pos].salt_buf[7];
405
406   const u32 salt_len = salt_bufs[salt_pos].salt_len;
407
408   const u32 r_14 = (32 + salt_len) * 8;
409
410   /**
411    * loop
412    */
413
414   u32x w0l = w0[0];
415
416   for (u32 il_pos = 0; il_pos < bfs_cnt; il_pos++)
417   {
418     const u32 w0r = c_bfs[il_pos].i;
419
420     w0[0] = w0l | w0r;
421
422     u32x a = MD5M_A;
423     u32x b = MD5M_B;
424     u32x c = MD5M_C;
425     u32x d = MD5M_D;
426
427     MD5_STEP (MD5_Fo, a, b, c, d, w0[0], MD5C00, MD5S00);
428     MD5_STEP (MD5_Fo, d, a, b, c, w0[1], MD5C01, MD5S01);
429     MD5_STEP (MD5_Fo, c, d, a, b, w0[2], MD5C02, MD5S02);
430     MD5_STEP (MD5_Fo, b, c, d, a, w0[3], MD5C03, MD5S03);
431     MD5_STEP (MD5_Fo, a, b, c, d, w1[0], MD5C04, MD5S00);
432     MD5_STEP (MD5_Fo, d, a, b, c, w1[1], MD5C05, MD5S01);
433     MD5_STEP (MD5_Fo, c, d, a, b, w1[2], MD5C06, MD5S02);
434     MD5_STEP (MD5_Fo, b, c, d, a, w1[3], MD5C07, MD5S03);
435     MD5_STEP (MD5_Fo, a, b, c, d, w2[0], MD5C08, MD5S00);
436     MD5_STEP (MD5_Fo, d, a, b, c, w2[1], MD5C09, MD5S01);
437     MD5_STEP (MD5_Fo, c, d, a, b, w2[2], MD5C0a, MD5S02);
438     MD5_STEP (MD5_Fo, b, c, d, a, w2[3], MD5C0b, MD5S03);
439     MD5_STEP (MD5_Fo, a, b, c, d, w3[0], MD5C0c, MD5S00);
440     MD5_STEP (MD5_Fo, d, a, b, c, w3[1], MD5C0d, MD5S01);
441     MD5_STEP (MD5_Fo, c, d, a, b, w3[2], MD5C0e, MD5S02);
442     MD5_STEP (MD5_Fo, b, c, d, a, w3[3], MD5C0f, MD5S03);
443
444     MD5_STEP (MD5_Go, a, b, c, d, w0[1], MD5C10, MD5S10);
445     MD5_STEP (MD5_Go, d, a, b, c, w1[2], MD5C11, MD5S11);
446     MD5_STEP (MD5_Go, c, d, a, b, w2[3], MD5C12, MD5S12);
447     MD5_STEP (MD5_Go, b, c, d, a, w0[0], MD5C13, MD5S13);
448     MD5_STEP (MD5_Go, a, b, c, d, w1[1], MD5C14, MD5S10);
449     MD5_STEP (MD5_Go, d, a, b, c, w2[2], MD5C15, MD5S11);
450     MD5_STEP (MD5_Go, c, d, a, b, w3[3], MD5C16, MD5S12);
451     MD5_STEP (MD5_Go, b, c, d, a, w1[0], MD5C17, MD5S13);
452     MD5_STEP (MD5_Go, a, b, c, d, w2[1], MD5C18, MD5S10);
453     MD5_STEP (MD5_Go, d, a, b, c, w3[2], MD5C19, MD5S11);
454     MD5_STEP (MD5_Go, c, d, a, b, w0[3], MD5C1a, MD5S12);
455     MD5_STEP (MD5_Go, b, c, d, a, w2[0], MD5C1b, MD5S13);
456     MD5_STEP (MD5_Go, a, b, c, d, w3[1], MD5C1c, MD5S10);
457     MD5_STEP (MD5_Go, d, a, b, c, w0[2], MD5C1d, MD5S11);
458     MD5_STEP (MD5_Go, c, d, a, b, w1[3], MD5C1e, MD5S12);
459     MD5_STEP (MD5_Go, b, c, d, a, w3[0], MD5C1f, MD5S13);
460
461     MD5_STEP (MD5_H , a, b, c, d, w1[1], MD5C20, MD5S20);
462     MD5_STEP (MD5_H , d, a, b, c, w2[0], MD5C21, MD5S21);
463     MD5_STEP (MD5_H , c, d, a, b, w2[3], MD5C22, MD5S22);
464     MD5_STEP (MD5_H , b, c, d, a, w3[2], MD5C23, MD5S23);
465     MD5_STEP (MD5_H , a, b, c, d, w0[1], MD5C24, MD5S20);
466     MD5_STEP (MD5_H , d, a, b, c, w1[0], MD5C25, MD5S21);
467     MD5_STEP (MD5_H , c, d, a, b, w1[3], MD5C26, MD5S22);
468     MD5_STEP (MD5_H , b, c, d, a, w2[2], MD5C27, MD5S23);
469     MD5_STEP (MD5_H , a, b, c, d, w3[1], MD5C28, MD5S20);
470     MD5_STEP (MD5_H , d, a, b, c, w0[0], MD5C29, MD5S21);
471     MD5_STEP (MD5_H , c, d, a, b, w0[3], MD5C2a, MD5S22);
472     MD5_STEP (MD5_H , b, c, d, a, w1[2], MD5C2b, MD5S23);
473     MD5_STEP (MD5_H , a, b, c, d, w2[1], MD5C2c, MD5S20);
474     MD5_STEP (MD5_H , d, a, b, c, w3[0], MD5C2d, MD5S21);
475     MD5_STEP (MD5_H , c, d, a, b, w3[3], MD5C2e, MD5S22);
476     MD5_STEP (MD5_H , b, c, d, a, w0[2], MD5C2f, MD5S23);
477
478     MD5_STEP (MD5_I , a, b, c, d, w0[0], MD5C30, MD5S30);
479     MD5_STEP (MD5_I , d, a, b, c, w1[3], MD5C31, MD5S31);
480     MD5_STEP (MD5_I , c, d, a, b, w3[2], MD5C32, MD5S32);
481     MD5_STEP (MD5_I , b, c, d, a, w1[1], MD5C33, MD5S33);
482     MD5_STEP (MD5_I , a, b, c, d, w3[0], MD5C34, MD5S30);
483     MD5_STEP (MD5_I , d, a, b, c, w0[3], MD5C35, MD5S31);
484     MD5_STEP (MD5_I , c, d, a, b, w2[2], MD5C36, MD5S32);
485     MD5_STEP (MD5_I , b, c, d, a, w0[1], MD5C37, MD5S33);
486     MD5_STEP (MD5_I , a, b, c, d, w2[0], MD5C38, MD5S30);
487     MD5_STEP (MD5_I , d, a, b, c, w3[3], MD5C39, MD5S31);
488     MD5_STEP (MD5_I , c, d, a, b, w1[2], MD5C3a, MD5S32);
489     MD5_STEP (MD5_I , b, c, d, a, w3[1], MD5C3b, MD5S33);
490     MD5_STEP (MD5_I , a, b, c, d, w1[0], MD5C3c, MD5S30);
491     MD5_STEP (MD5_I , d, a, b, c, w2[3], MD5C3d, MD5S31);
492     MD5_STEP (MD5_I , c, d, a, b, w0[2], MD5C3e, MD5S32);
493     MD5_STEP (MD5_I , b, c, d, a, w2[1], MD5C3f, MD5S33);
494
495     a += MD5M_A;
496     b += MD5M_B;
497     c += MD5M_C;
498     d += MD5M_D;
499
500     const u32x w0_t = uint_to_hex_lower8 ((a >>  0) & 255) <<  0
501                      | uint_to_hex_lower8 ((a >>  8) & 255) << 16;
502     const u32x w1_t = uint_to_hex_lower8 ((a >> 16) & 255) <<  0
503                      | uint_to_hex_lower8 ((a >> 24) & 255) << 16;
504     const u32x w2_t = uint_to_hex_lower8 ((b >>  0) & 255) <<  0
505                      | uint_to_hex_lower8 ((b >>  8) & 255) << 16;
506     const u32x w3_t = uint_to_hex_lower8 ((b >> 16) & 255) <<  0
507                      | uint_to_hex_lower8 ((b >> 24) & 255) << 16;
508     const u32x w4_t = uint_to_hex_lower8 ((c >>  0) & 255) <<  0
509                      | uint_to_hex_lower8 ((c >>  8) & 255) << 16;
510     const u32x w5_t = uint_to_hex_lower8 ((c >> 16) & 255) <<  0
511                      | uint_to_hex_lower8 ((c >> 24) & 255) << 16;
512     const u32x w6_t = uint_to_hex_lower8 ((d >>  0) & 255) <<  0
513                      | uint_to_hex_lower8 ((d >>  8) & 255) << 16;
514     const u32x w7_t = uint_to_hex_lower8 ((d >> 16) & 255) <<  0
515                      | uint_to_hex_lower8 ((d >> 24) & 255) << 16;
516
517     const u32 w8_t = s[0];
518     const u32 w9_t = s[1];
519     const u32 wa_t = s[2];
520     const u32 wb_t = s[3];
521     const u32 wc_t = s[4];
522     const u32 wd_t = s[5];
523     const u32 we_t = s[6];
524     const u32 wf_t = s[7];
525
526     a = MD5M_A;
527     b = MD5M_B;
528     c = MD5M_C;
529     d = MD5M_D;
530
531     MD5_STEP (MD5_Fo, a, b, c, d, w0_t, MD5C00, MD5S00);
532     MD5_STEP (MD5_Fo, d, a, b, c, w1_t, MD5C01, MD5S01);
533     MD5_STEP (MD5_Fo, c, d, a, b, w2_t, MD5C02, MD5S02);
534     MD5_STEP (MD5_Fo, b, c, d, a, w3_t, MD5C03, MD5S03);
535     MD5_STEP (MD5_Fo, a, b, c, d, w4_t, MD5C04, MD5S00);
536     MD5_STEP (MD5_Fo, d, a, b, c, w5_t, MD5C05, MD5S01);
537     MD5_STEP (MD5_Fo, c, d, a, b, w6_t, MD5C06, MD5S02);
538     MD5_STEP (MD5_Fo, b, c, d, a, w7_t, MD5C07, MD5S03);
539     MD5_STEP (MD5_Fo, a, b, c, d, w8_t, MD5C08, MD5S00);
540     MD5_STEP (MD5_Fo, d, a, b, c, w9_t, MD5C09, MD5S01);
541     MD5_STEP (MD5_Fo, c, d, a, b, wa_t, MD5C0a, MD5S02);
542     MD5_STEP (MD5_Fo, b, c, d, a, wb_t, MD5C0b, MD5S03);
543     MD5_STEP (MD5_Fo, a, b, c, d, wc_t, MD5C0c, MD5S00);
544     MD5_STEP (MD5_Fo, d, a, b, c, wd_t, MD5C0d, MD5S01);
545     MD5_STEP (MD5_Fo, c, d, a, b, we_t, MD5C0e, MD5S02);
546     MD5_STEP (MD5_Fo, b, c, d, a, wf_t, MD5C0f, MD5S03);
547
548     MD5_STEP (MD5_Go, a, b, c, d, w1_t, MD5C10, MD5S10);
549     MD5_STEP (MD5_Go, d, a, b, c, w6_t, MD5C11, MD5S11);
550     MD5_STEP (MD5_Go, c, d, a, b, wb_t, MD5C12, MD5S12);
551     MD5_STEP (MD5_Go, b, c, d, a, w0_t, MD5C13, MD5S13);
552     MD5_STEP (MD5_Go, a, b, c, d, w5_t, MD5C14, MD5S10);
553     MD5_STEP (MD5_Go, d, a, b, c, wa_t, MD5C15, MD5S11);
554     MD5_STEP (MD5_Go, c, d, a, b, wf_t, MD5C16, MD5S12);
555     MD5_STEP (MD5_Go, b, c, d, a, w4_t, MD5C17, MD5S13);
556     MD5_STEP (MD5_Go, a, b, c, d, w9_t, MD5C18, MD5S10);
557     MD5_STEP (MD5_Go, d, a, b, c, we_t, MD5C19, MD5S11);
558     MD5_STEP (MD5_Go, c, d, a, b, w3_t, MD5C1a, MD5S12);
559     MD5_STEP (MD5_Go, b, c, d, a, w8_t, MD5C1b, MD5S13);
560     MD5_STEP (MD5_Go, a, b, c, d, wd_t, MD5C1c, MD5S10);
561     MD5_STEP (MD5_Go, d, a, b, c, w2_t, MD5C1d, MD5S11);
562     MD5_STEP (MD5_Go, c, d, a, b, w7_t, MD5C1e, MD5S12);
563     MD5_STEP (MD5_Go, b, c, d, a, wc_t, MD5C1f, MD5S13);
564
565     MD5_STEP (MD5_H , a, b, c, d, w5_t, MD5C20, MD5S20);
566     MD5_STEP (MD5_H , d, a, b, c, w8_t, MD5C21, MD5S21);
567     MD5_STEP (MD5_H , c, d, a, b, wb_t, MD5C22, MD5S22);
568     MD5_STEP (MD5_H , b, c, d, a, we_t, MD5C23, MD5S23);
569     MD5_STEP (MD5_H , a, b, c, d, w1_t, MD5C24, MD5S20);
570     MD5_STEP (MD5_H , d, a, b, c, w4_t, MD5C25, MD5S21);
571     MD5_STEP (MD5_H , c, d, a, b, w7_t, MD5C26, MD5S22);
572     MD5_STEP (MD5_H , b, c, d, a, wa_t, MD5C27, MD5S23);
573     MD5_STEP (MD5_H , a, b, c, d, wd_t, MD5C28, MD5S20);
574     MD5_STEP (MD5_H , d, a, b, c, w0_t, MD5C29, MD5S21);
575     MD5_STEP (MD5_H , c, d, a, b, w3_t, MD5C2a, MD5S22);
576     MD5_STEP (MD5_H , b, c, d, a, w6_t, MD5C2b, MD5S23);
577     MD5_STEP (MD5_H , a, b, c, d, w9_t, MD5C2c, MD5S20);
578     MD5_STEP (MD5_H , d, a, b, c, wc_t, MD5C2d, MD5S21);
579     MD5_STEP (MD5_H , c, d, a, b, wf_t, MD5C2e, MD5S22);
580     MD5_STEP (MD5_H , b, c, d, a, w2_t, MD5C2f, MD5S23);
581
582     MD5_STEP (MD5_I , a, b, c, d, w0_t, MD5C30, MD5S30);
583     MD5_STEP (MD5_I , d, a, b, c, w7_t, MD5C31, MD5S31);
584     MD5_STEP (MD5_I , c, d, a, b, we_t, MD5C32, MD5S32);
585     MD5_STEP (MD5_I , b, c, d, a, w5_t, MD5C33, MD5S33);
586     MD5_STEP (MD5_I , a, b, c, d, wc_t, MD5C34, MD5S30);
587     MD5_STEP (MD5_I , d, a, b, c, w3_t, MD5C35, MD5S31);
588     MD5_STEP (MD5_I , c, d, a, b, wa_t, MD5C36, MD5S32);
589     MD5_STEP (MD5_I , b, c, d, a, w1_t, MD5C37, MD5S33);
590     MD5_STEP (MD5_I , a, b, c, d, w8_t, MD5C38, MD5S30);
591     MD5_STEP (MD5_I , d, a, b, c, wf_t, MD5C39, MD5S31);
592     MD5_STEP (MD5_I , c, d, a, b, w6_t, MD5C3a, MD5S32);
593     MD5_STEP (MD5_I , b, c, d, a, wd_t, MD5C3b, MD5S33);
594     MD5_STEP (MD5_I , a, b, c, d, w4_t, MD5C3c, MD5S30);
595     MD5_STEP (MD5_I , d, a, b, c, wb_t, MD5C3d, MD5S31);
596     MD5_STEP (MD5_I , c, d, a, b, w2_t, MD5C3e, MD5S32);
597     MD5_STEP (MD5_I , b, c, d, a, w9_t, MD5C3f, MD5S33);
598
599     const u32x r_a = a + MD5M_A;
600     const u32x r_b = b + MD5M_B;
601     const u32x r_c = c + MD5M_C;
602     const u32x r_d = d + MD5M_D;
603
604     a = r_a;
605     b = r_b;
606     c = r_c;
607     d = r_d;
608
609     MD5_STEP0(MD5_Fo, a, b, c, d,       MD5C00, MD5S00);
610     MD5_STEP0(MD5_Fo, d, a, b, c,       MD5C01, MD5S01);
611     MD5_STEP0(MD5_Fo, c, d, a, b,       MD5C02, MD5S02);
612     MD5_STEP0(MD5_Fo, b, c, d, a,       MD5C03, MD5S03);
613     MD5_STEP0(MD5_Fo, a, b, c, d,       MD5C04, MD5S00);
614     MD5_STEP0(MD5_Fo, d, a, b, c,       MD5C05, MD5S01);
615     MD5_STEP0(MD5_Fo, c, d, a, b,       MD5C06, MD5S02);
616     MD5_STEP0(MD5_Fo, b, c, d, a,       MD5C07, MD5S03);
617     MD5_STEP0(MD5_Fo, a, b, c, d,       MD5C08, MD5S00);
618     MD5_STEP0(MD5_Fo, d, a, b, c,       MD5C09, MD5S01);
619     MD5_STEP0(MD5_Fo, c, d, a, b,       MD5C0a, MD5S02);
620     MD5_STEP0(MD5_Fo, b, c, d, a,       MD5C0b, MD5S03);
621     MD5_STEP0(MD5_Fo, a, b, c, d,       MD5C0c, MD5S00);
622     MD5_STEP0(MD5_Fo, d, a, b, c,       MD5C0d, MD5S01);
623     MD5_STEP (MD5_Fo, c, d, a, b, r_14, MD5C0e, MD5S02);
624     MD5_STEP0(MD5_Fo, b, c, d, a,       MD5C0f, MD5S03);
625
626     MD5_STEP0(MD5_Go, a, b, c, d,       MD5C10, MD5S10);
627     MD5_STEP0(MD5_Go, d, a, b, c,       MD5C11, MD5S11);
628     MD5_STEP0(MD5_Go, c, d, a, b,       MD5C12, MD5S12);
629     MD5_STEP0(MD5_Go, b, c, d, a,       MD5C13, MD5S13);
630     MD5_STEP0(MD5_Go, a, b, c, d,       MD5C14, MD5S10);
631     MD5_STEP0(MD5_Go, d, a, b, c,       MD5C15, MD5S11);
632     MD5_STEP0(MD5_Go, c, d, a, b,       MD5C16, MD5S12);
633     MD5_STEP0(MD5_Go, b, c, d, a,       MD5C17, MD5S13);
634     MD5_STEP0(MD5_Go, a, b, c, d,       MD5C18, MD5S10);
635     MD5_STEP (MD5_Go, d, a, b, c, r_14, MD5C19, MD5S11);
636     MD5_STEP0(MD5_Go, c, d, a, b,       MD5C1a, MD5S12);
637     MD5_STEP0(MD5_Go, b, c, d, a,       MD5C1b, MD5S13);
638     MD5_STEP0(MD5_Go, a, b, c, d,       MD5C1c, MD5S10);
639     MD5_STEP0(MD5_Go, d, a, b, c,       MD5C1d, MD5S11);
640     MD5_STEP0(MD5_Go, c, d, a, b,       MD5C1e, MD5S12);
641     MD5_STEP0(MD5_Go, b, c, d, a,       MD5C1f, MD5S13);
642
643     MD5_STEP0(MD5_H , a, b, c, d,       MD5C20, MD5S20);
644     MD5_STEP0(MD5_H , d, a, b, c,       MD5C21, MD5S21);
645     MD5_STEP0(MD5_H , c, d, a, b,       MD5C22, MD5S22);
646     MD5_STEP (MD5_H , b, c, d, a, r_14, MD5C23, MD5S23);
647     MD5_STEP0(MD5_H , a, b, c, d,       MD5C24, MD5S20);
648     MD5_STEP0(MD5_H , d, a, b, c,       MD5C25, MD5S21);
649     MD5_STEP0(MD5_H , c, d, a, b,       MD5C26, MD5S22);
650     MD5_STEP0(MD5_H , b, c, d, a,       MD5C27, MD5S23);
651     MD5_STEP0(MD5_H , a, b, c, d,       MD5C28, MD5S20);
652     MD5_STEP0(MD5_H , d, a, b, c,       MD5C29, MD5S21);
653     MD5_STEP0(MD5_H , c, d, a, b,       MD5C2a, MD5S22);
654     MD5_STEP0(MD5_H , b, c, d, a,       MD5C2b, MD5S23);
655     MD5_STEP0(MD5_H , a, b, c, d,       MD5C2c, MD5S20);
656     MD5_STEP0(MD5_H , d, a, b, c,       MD5C2d, MD5S21);
657     MD5_STEP0(MD5_H , c, d, a, b,       MD5C2e, MD5S22);
658     MD5_STEP0(MD5_H , b, c, d, a,       MD5C2f, MD5S23);
659
660     MD5_STEP0(MD5_I , a, b, c, d,       MD5C30, MD5S30);
661     MD5_STEP0(MD5_I , d, a, b, c,       MD5C31, MD5S31);
662     MD5_STEP (MD5_I , c, d, a, b, r_14, MD5C32, MD5S32);
663     MD5_STEP0(MD5_I , b, c, d, a,       MD5C33, MD5S33);
664     MD5_STEP0(MD5_I , a, b, c, d,       MD5C34, MD5S30);
665     MD5_STEP0(MD5_I , d, a, b, c,       MD5C35, MD5S31);
666     MD5_STEP0(MD5_I , c, d, a, b,       MD5C36, MD5S32);
667     MD5_STEP0(MD5_I , b, c, d, a,       MD5C37, MD5S33);
668     MD5_STEP0(MD5_I , a, b, c, d,       MD5C38, MD5S30);
669     MD5_STEP0(MD5_I , d, a, b, c,       MD5C39, MD5S31);
670     MD5_STEP0(MD5_I , c, d, a, b,       MD5C3a, MD5S32);
671     MD5_STEP0(MD5_I , b, c, d, a,       MD5C3b, MD5S33);
672     MD5_STEP0(MD5_I , a, b, c, d,       MD5C3c, MD5S30);
673
674     if ((a + r_a) != search[0]) continue;
675
676     MD5_STEP0(MD5_I , d, a, b, c,       MD5C3d, MD5S31);
677     MD5_STEP0(MD5_I , c, d, a, b,       MD5C3e, MD5S32);
678     MD5_STEP0(MD5_I , b, c, d, a,       MD5C3f, MD5S33);
679
680     a += r_a;
681     b += r_b;
682     c += r_c;
683     d += r_d;
684
685     const u32x r0 = a;
686     const u32x r1 = d;
687     const u32x r2 = c;
688     const u32x r3 = b;
689
690     #include VECT_COMPARE_S
691   }
692 }
693
694 extern "C" __global__ void __launch_bounds__ (256, 1) m02710_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)
695 {
696   /**
697    * base
698    */
699
700   const u32 gid = (blockIdx.x * blockDim.x) + threadIdx.x;
701   const u32 lid = threadIdx.x;
702
703   u32x w0[4];
704
705   w0[0] = pws[gid].i[ 0];
706   w0[1] = pws[gid].i[ 1];
707   w0[2] = pws[gid].i[ 2];
708   w0[3] = pws[gid].i[ 3];
709
710   u32x w1[4];
711
712   w1[0] = 0;
713   w1[1] = 0;
714   w1[2] = 0;
715   w1[3] = 0;
716
717   u32x w2[4];
718
719   w2[0] = 0;
720   w2[1] = 0;
721   w2[2] = 0;
722   w2[3] = 0;
723
724   u32x w3[4];
725
726   w3[0] = 0;
727   w3[1] = 0;
728   w3[2] = pws[gid].i[14];
729   w3[3] = 0;
730
731   const u32 pw_len = pws[gid].pw_len;
732
733   /**
734    * bin2asc table
735    */
736
737   l_bin2asc[lid] = c_bin2asc[(lid >> 0) & 15] << 8
738                  | c_bin2asc[(lid >> 4) & 15] << 0;
739
740   __syncthreads ();
741
742   if (gid >= gid_max) return;
743
744   /**
745    * main
746    */
747
748   m02710m (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);
749 }
750
751 extern "C" __global__ void __launch_bounds__ (256, 1) m02710_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)
752 {
753   /**
754    * base
755    */
756
757   const u32 gid = (blockIdx.x * blockDim.x) + threadIdx.x;
758   const u32 lid = threadIdx.x;
759
760   u32x w0[4];
761
762   w0[0] = pws[gid].i[ 0];
763   w0[1] = pws[gid].i[ 1];
764   w0[2] = pws[gid].i[ 2];
765   w0[3] = pws[gid].i[ 3];
766
767   u32x w1[4];
768
769   w1[0] = pws[gid].i[ 4];
770   w1[1] = pws[gid].i[ 5];
771   w1[2] = pws[gid].i[ 6];
772   w1[3] = pws[gid].i[ 7];
773
774   u32x w2[4];
775
776   w2[0] = 0;
777   w2[1] = 0;
778   w2[2] = 0;
779   w2[3] = 0;
780
781   u32x w3[4];
782
783   w3[0] = 0;
784   w3[1] = 0;
785   w3[2] = pws[gid].i[14];
786   w3[3] = 0;
787
788   const u32 pw_len = pws[gid].pw_len;
789
790   /**
791    * bin2asc table
792    */
793
794   l_bin2asc[lid] = c_bin2asc[(lid >> 0) & 15] << 8
795                  | c_bin2asc[(lid >> 4) & 15] << 0;
796
797   __syncthreads ();
798
799   if (gid >= gid_max) return;
800
801   /**
802    * main
803    */
804
805   m02710m (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);
806 }
807
808 extern "C" __global__ void __launch_bounds__ (256, 1) m02710_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)
809 {
810   /**
811    * base
812    */
813
814   const u32 gid = (blockIdx.x * blockDim.x) + threadIdx.x;
815   const u32 lid = threadIdx.x;
816
817   u32x w0[4];
818
819   w0[0] = pws[gid].i[ 0];
820   w0[1] = pws[gid].i[ 1];
821   w0[2] = pws[gid].i[ 2];
822   w0[3] = pws[gid].i[ 3];
823
824   u32x w1[4];
825
826   w1[0] = pws[gid].i[ 4];
827   w1[1] = pws[gid].i[ 5];
828   w1[2] = pws[gid].i[ 6];
829   w1[3] = pws[gid].i[ 7];
830
831   u32x w2[4];
832
833   w2[0] = pws[gid].i[ 8];
834   w2[1] = pws[gid].i[ 9];
835   w2[2] = pws[gid].i[10];
836   w2[3] = pws[gid].i[11];
837
838   u32x w3[4];
839
840   w3[0] = pws[gid].i[12];
841   w3[1] = pws[gid].i[13];
842   w3[2] = pws[gid].i[14];
843   w3[3] = pws[gid].i[15];
844
845   const u32 pw_len = pws[gid].pw_len;
846
847   /**
848    * bin2asc table
849    */
850
851   l_bin2asc[lid] = c_bin2asc[(lid >> 0) & 15] << 8
852                  | c_bin2asc[(lid >> 4) & 15] << 0;
853
854   __syncthreads ();
855
856   if (gid >= gid_max) return;
857
858   /**
859    * main
860    */
861
862   m02710m (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);
863 }
864
865 extern "C" __global__ void __launch_bounds__ (256, 1) m02710_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)
866 {
867   /**
868    * base
869    */
870
871   const u32 gid = (blockIdx.x * blockDim.x) + threadIdx.x;
872   const u32 lid = threadIdx.x;
873
874   u32x w0[4];
875
876   w0[0] = pws[gid].i[ 0];
877   w0[1] = pws[gid].i[ 1];
878   w0[2] = pws[gid].i[ 2];
879   w0[3] = pws[gid].i[ 3];
880
881   u32x w1[4];
882
883   w1[0] = 0;
884   w1[1] = 0;
885   w1[2] = 0;
886   w1[3] = 0;
887
888   u32x w2[4];
889
890   w2[0] = 0;
891   w2[1] = 0;
892   w2[2] = 0;
893   w2[3] = 0;
894
895   u32x w3[4];
896
897   w3[0] = 0;
898   w3[1] = 0;
899   w3[2] = pws[gid].i[14];
900   w3[3] = 0;
901
902   const u32 pw_len = pws[gid].pw_len;
903
904   /**
905    * bin2asc table
906    */
907
908   l_bin2asc[lid] = c_bin2asc[(lid >> 0) & 15] << 8
909                  | c_bin2asc[(lid >> 4) & 15] << 0;
910
911   __syncthreads ();
912
913   if (gid >= gid_max) return;
914
915   /**
916    * main
917    */
918
919   m02710s (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);
920 }
921
922 extern "C" __global__ void __launch_bounds__ (256, 1) m02710_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)
923 {
924   /**
925    * base
926    */
927
928   const u32 gid = (blockIdx.x * blockDim.x) + threadIdx.x;
929   const u32 lid = threadIdx.x;
930
931   u32x w0[4];
932
933   w0[0] = pws[gid].i[ 0];
934   w0[1] = pws[gid].i[ 1];
935   w0[2] = pws[gid].i[ 2];
936   w0[3] = pws[gid].i[ 3];
937
938   u32x w1[4];
939
940   w1[0] = pws[gid].i[ 4];
941   w1[1] = pws[gid].i[ 5];
942   w1[2] = pws[gid].i[ 6];
943   w1[3] = pws[gid].i[ 7];
944
945   u32x w2[4];
946
947   w2[0] = 0;
948   w2[1] = 0;
949   w2[2] = 0;
950   w2[3] = 0;
951
952   u32x w3[4];
953
954   w3[0] = 0;
955   w3[1] = 0;
956   w3[2] = pws[gid].i[14];
957   w3[3] = 0;
958
959   const u32 pw_len = pws[gid].pw_len;
960
961   /**
962    * bin2asc table
963    */
964
965   l_bin2asc[lid] = c_bin2asc[(lid >> 0) & 15] << 8
966                  | c_bin2asc[(lid >> 4) & 15] << 0;
967
968   __syncthreads ();
969
970   if (gid >= gid_max) return;
971
972   /**
973    * main
974    */
975
976   m02710s (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);
977 }
978
979 extern "C" __global__ void __launch_bounds__ (256, 1) m02710_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)
980 {
981   /**
982    * base
983    */
984
985   const u32 gid = (blockIdx.x * blockDim.x) + threadIdx.x;
986   const u32 lid = threadIdx.x;
987
988   u32x w0[4];
989
990   w0[0] = pws[gid].i[ 0];
991   w0[1] = pws[gid].i[ 1];
992   w0[2] = pws[gid].i[ 2];
993   w0[3] = pws[gid].i[ 3];
994
995   u32x w1[4];
996
997   w1[0] = pws[gid].i[ 4];
998   w1[1] = pws[gid].i[ 5];
999   w1[2] = pws[gid].i[ 6];
1000   w1[3] = pws[gid].i[ 7];
1001
1002   u32x w2[4];
1003
1004   w2[0] = pws[gid].i[ 8];
1005   w2[1] = pws[gid].i[ 9];
1006   w2[2] = pws[gid].i[10];
1007   w2[3] = pws[gid].i[11];
1008
1009   u32x w3[4];
1010
1011   w3[0] = pws[gid].i[12];
1012   w3[1] = pws[gid].i[13];
1013   w3[2] = pws[gid].i[14];
1014   w3[3] = pws[gid].i[15];
1015
1016   const u32 pw_len = pws[gid].pw_len;
1017
1018   /**
1019    * bin2asc table
1020    */
1021
1022   l_bin2asc[lid] = c_bin2asc[(lid >> 0) & 15] << 8
1023                  | c_bin2asc[(lid >> 4) & 15] << 0;
1024
1025   __syncthreads ();
1026
1027   if (gid >= gid_max) return;
1028
1029   /**
1030    * main
1031    */
1032
1033   m02710s (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);
1034 }