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