Fix path to includes
[hashcat.git] / OpenCL / m02810_a3.cl
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 #define DGST_R0 0
12 #define DGST_R1 3
13 #define DGST_R2 2
14 #define DGST_R3 1
15
16 #include "include/kernel_functions.c"
17 #include "OpenCL/types_ocl.c"
18 #include "OpenCL/common.c"
19
20 #define COMPARE_S "OpenCL/check_single_comp4.c"
21 #define COMPARE_M "OpenCL/check_multi_comp4.c"
22
23 #define uint_to_hex_lower8(i) l_bin2asc[(i)]
24
25 static void m02810m (u32 w0[4], u32 w1[4], u32 w2[4], u32 w3[4], const u32 pw_len, __global pw_t *pws, __global gpu_rule_t *rules_buf, __global comb_t *combs_buf, __global bf_t *bfs_buf, __global void *tmps, __global void *hooks, __global u32 *bitmaps_buf_s1_a, __global u32 *bitmaps_buf_s1_b, __global u32 *bitmaps_buf_s1_c, __global u32 *bitmaps_buf_s1_d, __global u32 *bitmaps_buf_s2_a, __global u32 *bitmaps_buf_s2_b, __global u32 *bitmaps_buf_s2_c, __global u32 *bitmaps_buf_s2_d, __global plain_t *plains_buf, __global digest_t *digests_buf, __global u32 *hashes_shown, __global salt_t *salt_bufs, __global void *esalt_bufs, __global u32 *d_return_buf, __global 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, __local u32 l_bin2asc[256])
26 {
27   /**
28    * modifier
29    */
30
31   const u32 gid = get_global_id (0);
32   const u32 lid = get_local_id (0);
33
34   /**
35    * salt
36    */
37
38   u32 s[8];
39
40   s[0] = salt_bufs[salt_pos].salt_buf_pc[0];
41   s[1] = salt_bufs[salt_pos].salt_buf_pc[1];
42   s[2] = salt_bufs[salt_pos].salt_buf_pc[2];
43   s[3] = salt_bufs[salt_pos].salt_buf_pc[3];
44   s[4] = salt_bufs[salt_pos].salt_buf_pc[4];
45   s[5] = salt_bufs[salt_pos].salt_buf_pc[5];
46   s[6] = salt_bufs[salt_pos].salt_buf_pc[6];
47   s[7] = salt_bufs[salt_pos].salt_buf_pc[7];
48
49   const u32 r_00 = 0x80;
50   const u32 r_14 = 64 * 8;
51
52   /**
53    * loop
54    */
55
56   u32 w0l = w0[0];
57
58   for (u32 il_pos = 0; il_pos < bfs_cnt; il_pos++)
59   {
60     const u32 w0r = bfs_buf[il_pos].i;
61
62     w0[0] = w0l | w0r;
63
64     u32 a = MD5M_A;
65     u32 b = MD5M_B;
66     u32 c = MD5M_C;
67     u32 d = MD5M_D;
68
69     MD5_STEP (MD5_Fo, a, b, c, d, w0[0], MD5C00, MD5S00);
70     MD5_STEP (MD5_Fo, d, a, b, c, w0[1], MD5C01, MD5S01);
71     MD5_STEP (MD5_Fo, c, d, a, b, w0[2], MD5C02, MD5S02);
72     MD5_STEP (MD5_Fo, b, c, d, a, w0[3], MD5C03, MD5S03);
73     MD5_STEP (MD5_Fo, a, b, c, d, w1[0], MD5C04, MD5S00);
74     MD5_STEP (MD5_Fo, d, a, b, c, w1[1], MD5C05, MD5S01);
75     MD5_STEP (MD5_Fo, c, d, a, b, w1[2], MD5C06, MD5S02);
76     MD5_STEP (MD5_Fo, b, c, d, a, w1[3], MD5C07, MD5S03);
77     MD5_STEP (MD5_Fo, a, b, c, d, w2[0], MD5C08, MD5S00);
78     MD5_STEP (MD5_Fo, d, a, b, c, w2[1], MD5C09, MD5S01);
79     MD5_STEP (MD5_Fo, c, d, a, b, w2[2], MD5C0a, MD5S02);
80     MD5_STEP (MD5_Fo, b, c, d, a, w2[3], MD5C0b, MD5S03);
81     MD5_STEP (MD5_Fo, a, b, c, d, w3[0], MD5C0c, MD5S00);
82     MD5_STEP (MD5_Fo, d, a, b, c, w3[1], MD5C0d, MD5S01);
83     MD5_STEP (MD5_Fo, c, d, a, b, w3[2], MD5C0e, MD5S02);
84     MD5_STEP (MD5_Fo, b, c, d, a, w3[3], MD5C0f, MD5S03);
85
86     MD5_STEP (MD5_Go, a, b, c, d, w0[1], MD5C10, MD5S10);
87     MD5_STEP (MD5_Go, d, a, b, c, w1[2], MD5C11, MD5S11);
88     MD5_STEP (MD5_Go, c, d, a, b, w2[3], MD5C12, MD5S12);
89     MD5_STEP (MD5_Go, b, c, d, a, w0[0], MD5C13, MD5S13);
90     MD5_STEP (MD5_Go, a, b, c, d, w1[1], MD5C14, MD5S10);
91     MD5_STEP (MD5_Go, d, a, b, c, w2[2], MD5C15, MD5S11);
92     MD5_STEP (MD5_Go, c, d, a, b, w3[3], MD5C16, MD5S12);
93     MD5_STEP (MD5_Go, b, c, d, a, w1[0], MD5C17, MD5S13);
94     MD5_STEP (MD5_Go, a, b, c, d, w2[1], MD5C18, MD5S10);
95     MD5_STEP (MD5_Go, d, a, b, c, w3[2], MD5C19, MD5S11);
96     MD5_STEP (MD5_Go, c, d, a, b, w0[3], MD5C1a, MD5S12);
97     MD5_STEP (MD5_Go, b, c, d, a, w2[0], MD5C1b, MD5S13);
98     MD5_STEP (MD5_Go, a, b, c, d, w3[1], MD5C1c, MD5S10);
99     MD5_STEP (MD5_Go, d, a, b, c, w0[2], MD5C1d, MD5S11);
100     MD5_STEP (MD5_Go, c, d, a, b, w1[3], MD5C1e, MD5S12);
101     MD5_STEP (MD5_Go, b, c, d, a, w3[0], MD5C1f, MD5S13);
102
103     MD5_STEP (MD5_H , a, b, c, d, w1[1], MD5C20, MD5S20);
104     MD5_STEP (MD5_H , d, a, b, c, w2[0], MD5C21, MD5S21);
105     MD5_STEP (MD5_H , c, d, a, b, w2[3], MD5C22, MD5S22);
106     MD5_STEP (MD5_H , b, c, d, a, w3[2], MD5C23, MD5S23);
107     MD5_STEP (MD5_H , a, b, c, d, w0[1], MD5C24, MD5S20);
108     MD5_STEP (MD5_H , d, a, b, c, w1[0], MD5C25, MD5S21);
109     MD5_STEP (MD5_H , c, d, a, b, w1[3], MD5C26, MD5S22);
110     MD5_STEP (MD5_H , b, c, d, a, w2[2], MD5C27, MD5S23);
111     MD5_STEP (MD5_H , a, b, c, d, w3[1], MD5C28, MD5S20);
112     MD5_STEP (MD5_H , d, a, b, c, w0[0], MD5C29, MD5S21);
113     MD5_STEP (MD5_H , c, d, a, b, w0[3], MD5C2a, MD5S22);
114     MD5_STEP (MD5_H , b, c, d, a, w1[2], MD5C2b, MD5S23);
115     MD5_STEP (MD5_H , a, b, c, d, w2[1], MD5C2c, MD5S20);
116     MD5_STEP (MD5_H , d, a, b, c, w3[0], MD5C2d, MD5S21);
117     MD5_STEP (MD5_H , c, d, a, b, w3[3], MD5C2e, MD5S22);
118     MD5_STEP (MD5_H , b, c, d, a, w0[2], MD5C2f, MD5S23);
119
120     MD5_STEP (MD5_I , a, b, c, d, w0[0], MD5C30, MD5S30);
121     MD5_STEP (MD5_I , d, a, b, c, w1[3], MD5C31, MD5S31);
122     MD5_STEP (MD5_I , c, d, a, b, w3[2], MD5C32, MD5S32);
123     MD5_STEP (MD5_I , b, c, d, a, w1[1], MD5C33, MD5S33);
124     MD5_STEP (MD5_I , a, b, c, d, w3[0], MD5C34, MD5S30);
125     MD5_STEP (MD5_I , d, a, b, c, w0[3], MD5C35, MD5S31);
126     MD5_STEP (MD5_I , c, d, a, b, w2[2], MD5C36, MD5S32);
127     MD5_STEP (MD5_I , b, c, d, a, w0[1], MD5C37, MD5S33);
128     MD5_STEP (MD5_I , a, b, c, d, w2[0], MD5C38, MD5S30);
129     MD5_STEP (MD5_I , d, a, b, c, w3[3], MD5C39, MD5S31);
130     MD5_STEP (MD5_I , c, d, a, b, w1[2], MD5C3a, MD5S32);
131     MD5_STEP (MD5_I , b, c, d, a, w3[1], MD5C3b, MD5S33);
132     MD5_STEP (MD5_I , a, b, c, d, w1[0], MD5C3c, MD5S30);
133     MD5_STEP (MD5_I , d, a, b, c, w2[3], MD5C3d, MD5S31);
134     MD5_STEP (MD5_I , c, d, a, b, w0[2], MD5C3e, MD5S32);
135     MD5_STEP (MD5_I , b, c, d, a, w2[1], MD5C3f, MD5S33);
136
137     a += MD5M_A;
138     b += MD5M_B;
139     c += MD5M_C;
140     d += MD5M_D;
141
142     const u32  w0_t = s[0];
143     const u32  w1_t = s[1];
144     const u32  w2_t = s[2];
145     const u32  w3_t = s[3];
146     const u32  w4_t = s[4];
147     const u32  w5_t = s[5];
148     const u32  w6_t = s[6];
149     const u32  w7_t = s[7];
150
151     const u32 w8_t = uint_to_hex_lower8 ((a >>  0) & 255) <<  0
152                      | uint_to_hex_lower8 ((a >>  8) & 255) << 16;
153     const u32 w9_t = uint_to_hex_lower8 ((a >> 16) & 255) <<  0
154                      | uint_to_hex_lower8 ((a >> 24) & 255) << 16;
155     const u32 wa_t = uint_to_hex_lower8 ((b >>  0) & 255) <<  0
156                      | uint_to_hex_lower8 ((b >>  8) & 255) << 16;
157     const u32 wb_t = uint_to_hex_lower8 ((b >> 16) & 255) <<  0
158                      | uint_to_hex_lower8 ((b >> 24) & 255) << 16;
159     const u32 wc_t = uint_to_hex_lower8 ((c >>  0) & 255) <<  0
160                      | uint_to_hex_lower8 ((c >>  8) & 255) << 16;
161     const u32 wd_t = uint_to_hex_lower8 ((c >> 16) & 255) <<  0
162                      | uint_to_hex_lower8 ((c >> 24) & 255) << 16;
163     const u32 we_t = uint_to_hex_lower8 ((d >>  0) & 255) <<  0
164                      | uint_to_hex_lower8 ((d >>  8) & 255) << 16;
165     const u32 wf_t = uint_to_hex_lower8 ((d >> 16) & 255) <<  0
166                      | uint_to_hex_lower8 ((d >> 24) & 255) << 16;
167
168     a = MD5M_A;
169     b = MD5M_B;
170     c = MD5M_C;
171     d = MD5M_D;
172
173     MD5_STEP (MD5_Fo, a, b, c, d, w0_t, MD5C00, MD5S00);
174     MD5_STEP (MD5_Fo, d, a, b, c, w1_t, MD5C01, MD5S01);
175     MD5_STEP (MD5_Fo, c, d, a, b, w2_t, MD5C02, MD5S02);
176     MD5_STEP (MD5_Fo, b, c, d, a, w3_t, MD5C03, MD5S03);
177     MD5_STEP (MD5_Fo, a, b, c, d, w4_t, MD5C04, MD5S00);
178     MD5_STEP (MD5_Fo, d, a, b, c, w5_t, MD5C05, MD5S01);
179     MD5_STEP (MD5_Fo, c, d, a, b, w6_t, MD5C06, MD5S02);
180     MD5_STEP (MD5_Fo, b, c, d, a, w7_t, MD5C07, MD5S03);
181     MD5_STEP (MD5_Fo, a, b, c, d, w8_t, MD5C08, MD5S00);
182     MD5_STEP (MD5_Fo, d, a, b, c, w9_t, MD5C09, MD5S01);
183     MD5_STEP (MD5_Fo, c, d, a, b, wa_t, MD5C0a, MD5S02);
184     MD5_STEP (MD5_Fo, b, c, d, a, wb_t, MD5C0b, MD5S03);
185     MD5_STEP (MD5_Fo, a, b, c, d, wc_t, MD5C0c, MD5S00);
186     MD5_STEP (MD5_Fo, d, a, b, c, wd_t, MD5C0d, MD5S01);
187     MD5_STEP (MD5_Fo, c, d, a, b, we_t, MD5C0e, MD5S02);
188     MD5_STEP (MD5_Fo, b, c, d, a, wf_t, MD5C0f, MD5S03);
189
190     MD5_STEP (MD5_Go, a, b, c, d, w1_t, MD5C10, MD5S10);
191     MD5_STEP (MD5_Go, d, a, b, c, w6_t, MD5C11, MD5S11);
192     MD5_STEP (MD5_Go, c, d, a, b, wb_t, MD5C12, MD5S12);
193     MD5_STEP (MD5_Go, b, c, d, a, w0_t, MD5C13, MD5S13);
194     MD5_STEP (MD5_Go, a, b, c, d, w5_t, MD5C14, MD5S10);
195     MD5_STEP (MD5_Go, d, a, b, c, wa_t, MD5C15, MD5S11);
196     MD5_STEP (MD5_Go, c, d, a, b, wf_t, MD5C16, MD5S12);
197     MD5_STEP (MD5_Go, b, c, d, a, w4_t, MD5C17, MD5S13);
198     MD5_STEP (MD5_Go, a, b, c, d, w9_t, MD5C18, MD5S10);
199     MD5_STEP (MD5_Go, d, a, b, c, we_t, MD5C19, MD5S11);
200     MD5_STEP (MD5_Go, c, d, a, b, w3_t, MD5C1a, MD5S12);
201     MD5_STEP (MD5_Go, b, c, d, a, w8_t, MD5C1b, MD5S13);
202     MD5_STEP (MD5_Go, a, b, c, d, wd_t, MD5C1c, MD5S10);
203     MD5_STEP (MD5_Go, d, a, b, c, w2_t, MD5C1d, MD5S11);
204     MD5_STEP (MD5_Go, c, d, a, b, w7_t, MD5C1e, MD5S12);
205     MD5_STEP (MD5_Go, b, c, d, a, wc_t, MD5C1f, MD5S13);
206
207     MD5_STEP (MD5_H , a, b, c, d, w5_t, MD5C20, MD5S20);
208     MD5_STEP (MD5_H , d, a, b, c, w8_t, MD5C21, MD5S21);
209     MD5_STEP (MD5_H , c, d, a, b, wb_t, MD5C22, MD5S22);
210     MD5_STEP (MD5_H , b, c, d, a, we_t, MD5C23, MD5S23);
211     MD5_STEP (MD5_H , a, b, c, d, w1_t, MD5C24, MD5S20);
212     MD5_STEP (MD5_H , d, a, b, c, w4_t, MD5C25, MD5S21);
213     MD5_STEP (MD5_H , c, d, a, b, w7_t, MD5C26, MD5S22);
214     MD5_STEP (MD5_H , b, c, d, a, wa_t, MD5C27, MD5S23);
215     MD5_STEP (MD5_H , a, b, c, d, wd_t, MD5C28, MD5S20);
216     MD5_STEP (MD5_H , d, a, b, c, w0_t, MD5C29, MD5S21);
217     MD5_STEP (MD5_H , c, d, a, b, w3_t, MD5C2a, MD5S22);
218     MD5_STEP (MD5_H , b, c, d, a, w6_t, MD5C2b, MD5S23);
219     MD5_STEP (MD5_H , a, b, c, d, w9_t, MD5C2c, MD5S20);
220     MD5_STEP (MD5_H , d, a, b, c, wc_t, MD5C2d, MD5S21);
221     MD5_STEP (MD5_H , c, d, a, b, wf_t, MD5C2e, MD5S22);
222     MD5_STEP (MD5_H , b, c, d, a, w2_t, MD5C2f, MD5S23);
223
224     MD5_STEP (MD5_I , a, b, c, d, w0_t, MD5C30, MD5S30);
225     MD5_STEP (MD5_I , d, a, b, c, w7_t, MD5C31, MD5S31);
226     MD5_STEP (MD5_I , c, d, a, b, we_t, MD5C32, MD5S32);
227     MD5_STEP (MD5_I , b, c, d, a, w5_t, MD5C33, MD5S33);
228     MD5_STEP (MD5_I , a, b, c, d, wc_t, MD5C34, MD5S30);
229     MD5_STEP (MD5_I , d, a, b, c, w3_t, MD5C35, MD5S31);
230     MD5_STEP (MD5_I , c, d, a, b, wa_t, MD5C36, MD5S32);
231     MD5_STEP (MD5_I , b, c, d, a, w1_t, MD5C37, MD5S33);
232     MD5_STEP (MD5_I , a, b, c, d, w8_t, MD5C38, MD5S30);
233     MD5_STEP (MD5_I , d, a, b, c, wf_t, MD5C39, MD5S31);
234     MD5_STEP (MD5_I , c, d, a, b, w6_t, MD5C3a, MD5S32);
235     MD5_STEP (MD5_I , b, c, d, a, wd_t, MD5C3b, MD5S33);
236     MD5_STEP (MD5_I , a, b, c, d, w4_t, MD5C3c, MD5S30);
237     MD5_STEP (MD5_I , d, a, b, c, wb_t, MD5C3d, MD5S31);
238     MD5_STEP (MD5_I , c, d, a, b, w2_t, MD5C3e, MD5S32);
239     MD5_STEP (MD5_I , b, c, d, a, w9_t, MD5C3f, MD5S33);
240
241     const u32 r_a = a + MD5M_A;
242     const u32 r_b = b + MD5M_B;
243     const u32 r_c = c + MD5M_C;
244     const u32 r_d = d + MD5M_D;
245
246     a = r_a;
247     b = r_b;
248     c = r_c;
249     d = r_d;
250
251     MD5_STEP (MD5_Fo, a, b, c, d, r_00, MD5C00, MD5S00);
252     MD5_STEP0(MD5_Fo, d, a, b, c,       MD5C01, MD5S01);
253     MD5_STEP0(MD5_Fo, c, d, a, b,       MD5C02, MD5S02);
254     MD5_STEP0(MD5_Fo, b, c, d, a,       MD5C03, MD5S03);
255     MD5_STEP0(MD5_Fo, a, b, c, d,       MD5C04, MD5S00);
256     MD5_STEP0(MD5_Fo, d, a, b, c,       MD5C05, MD5S01);
257     MD5_STEP0(MD5_Fo, c, d, a, b,       MD5C06, MD5S02);
258     MD5_STEP0(MD5_Fo, b, c, d, a,       MD5C07, MD5S03);
259     MD5_STEP0(MD5_Fo, a, b, c, d,       MD5C08, MD5S00);
260     MD5_STEP0(MD5_Fo, d, a, b, c,       MD5C09, MD5S01);
261     MD5_STEP0(MD5_Fo, c, d, a, b,       MD5C0a, MD5S02);
262     MD5_STEP0(MD5_Fo, b, c, d, a,       MD5C0b, MD5S03);
263     MD5_STEP0(MD5_Fo, a, b, c, d,       MD5C0c, MD5S00);
264     MD5_STEP0(MD5_Fo, d, a, b, c,       MD5C0d, MD5S01);
265     MD5_STEP (MD5_Fo, c, d, a, b, r_14, MD5C0e, MD5S02);
266     MD5_STEP0(MD5_Fo, b, c, d, a,       MD5C0f, MD5S03);
267
268     MD5_STEP0(MD5_Go, a, b, c, d,       MD5C10, MD5S10);
269     MD5_STEP0(MD5_Go, d, a, b, c,       MD5C11, MD5S11);
270     MD5_STEP0(MD5_Go, c, d, a, b,       MD5C12, MD5S12);
271     MD5_STEP (MD5_Go, b, c, d, a, r_00, MD5C13, MD5S13);
272     MD5_STEP0(MD5_Go, a, b, c, d,       MD5C14, MD5S10);
273     MD5_STEP0(MD5_Go, d, a, b, c,       MD5C15, MD5S11);
274     MD5_STEP0(MD5_Go, c, d, a, b,       MD5C16, MD5S12);
275     MD5_STEP0(MD5_Go, b, c, d, a,       MD5C17, MD5S13);
276     MD5_STEP0(MD5_Go, a, b, c, d,       MD5C18, MD5S10);
277     MD5_STEP (MD5_Go, d, a, b, c, r_14, MD5C19, MD5S11);
278     MD5_STEP0(MD5_Go, c, d, a, b,       MD5C1a, MD5S12);
279     MD5_STEP0(MD5_Go, b, c, d, a,       MD5C1b, MD5S13);
280     MD5_STEP0(MD5_Go, a, b, c, d,       MD5C1c, MD5S10);
281     MD5_STEP0(MD5_Go, d, a, b, c,       MD5C1d, MD5S11);
282     MD5_STEP0(MD5_Go, c, d, a, b,       MD5C1e, MD5S12);
283     MD5_STEP0(MD5_Go, b, c, d, a,       MD5C1f, MD5S13);
284
285     MD5_STEP0(MD5_H , a, b, c, d,       MD5C20, MD5S20);
286     MD5_STEP0(MD5_H , d, a, b, c,       MD5C21, MD5S21);
287     MD5_STEP0(MD5_H , c, d, a, b,       MD5C22, MD5S22);
288     MD5_STEP (MD5_H , b, c, d, a, r_14, MD5C23, MD5S23);
289     MD5_STEP0(MD5_H , a, b, c, d,       MD5C24, MD5S20);
290     MD5_STEP0(MD5_H , d, a, b, c,       MD5C25, MD5S21);
291     MD5_STEP0(MD5_H , c, d, a, b,       MD5C26, MD5S22);
292     MD5_STEP0(MD5_H , b, c, d, a,       MD5C27, MD5S23);
293     MD5_STEP0(MD5_H , a, b, c, d,       MD5C28, MD5S20);
294     MD5_STEP (MD5_H , d, a, b, c, r_00, MD5C29, MD5S21);
295     MD5_STEP0(MD5_H , c, d, a, b,       MD5C2a, MD5S22);
296     MD5_STEP0(MD5_H , b, c, d, a,       MD5C2b, MD5S23);
297     MD5_STEP0(MD5_H , a, b, c, d,       MD5C2c, MD5S20);
298     MD5_STEP0(MD5_H , d, a, b, c,       MD5C2d, MD5S21);
299     MD5_STEP0(MD5_H , c, d, a, b,       MD5C2e, MD5S22);
300     MD5_STEP0(MD5_H , b, c, d, a,       MD5C2f, MD5S23);
301
302     MD5_STEP (MD5_I , a, b, c, d, r_00, MD5C30, MD5S30);
303     MD5_STEP0(MD5_I , d, a, b, c,       MD5C31, MD5S31);
304     MD5_STEP (MD5_I , c, d, a, b, r_14, MD5C32, MD5S32);
305     MD5_STEP0(MD5_I , b, c, d, a,       MD5C33, MD5S33);
306     MD5_STEP0(MD5_I , a, b, c, d,       MD5C34, MD5S30);
307     MD5_STEP0(MD5_I , d, a, b, c,       MD5C35, MD5S31);
308     MD5_STEP0(MD5_I , c, d, a, b,       MD5C36, MD5S32);
309     MD5_STEP0(MD5_I , b, c, d, a,       MD5C37, MD5S33);
310     MD5_STEP0(MD5_I , a, b, c, d,       MD5C38, MD5S30);
311     MD5_STEP0(MD5_I , d, a, b, c,       MD5C39, MD5S31);
312     MD5_STEP0(MD5_I , c, d, a, b,       MD5C3a, MD5S32);
313     MD5_STEP0(MD5_I , b, c, d, a,       MD5C3b, MD5S33);
314     MD5_STEP0(MD5_I , a, b, c, d,       MD5C3c, MD5S30);
315     MD5_STEP0(MD5_I , d, a, b, c,       MD5C3d, MD5S31);
316     MD5_STEP0(MD5_I , c, d, a, b,       MD5C3e, MD5S32);
317     MD5_STEP0(MD5_I , b, c, d, a,       MD5C3f, MD5S33);
318
319     a += r_a;
320     b += r_b;
321     c += r_c;
322     d += r_d;
323
324     const u32 r0 = a;
325     const u32 r1 = d;
326     const u32 r2 = c;
327     const u32 r3 = b;
328
329     #include COMPARE_M
330   }
331 }
332
333 static void m02810s (u32 w0[4], u32 w1[4], u32 w2[4], u32 w3[4], const u32 pw_len, __global pw_t *pws, __global gpu_rule_t *rules_buf, __global comb_t *combs_buf, __global bf_t *bfs_buf, __global void *tmps, __global void *hooks, __global u32 *bitmaps_buf_s1_a, __global u32 *bitmaps_buf_s1_b, __global u32 *bitmaps_buf_s1_c, __global u32 *bitmaps_buf_s1_d, __global u32 *bitmaps_buf_s2_a, __global u32 *bitmaps_buf_s2_b, __global u32 *bitmaps_buf_s2_c, __global u32 *bitmaps_buf_s2_d, __global plain_t *plains_buf, __global digest_t *digests_buf, __global u32 *hashes_shown, __global salt_t *salt_bufs, __global void *esalt_bufs, __global u32 *d_return_buf, __global 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, __local u32 l_bin2asc[256])
334 {
335   /**
336    * modifier
337    */
338
339   const u32 gid = get_global_id (0);
340   const u32 lid = get_local_id (0);
341
342   /**
343    * digest
344    */
345
346   const u32 search[4] =
347   {
348     digests_buf[digests_offset].digest_buf[DGST_R0],
349     digests_buf[digests_offset].digest_buf[DGST_R1],
350     digests_buf[digests_offset].digest_buf[DGST_R2],
351     digests_buf[digests_offset].digest_buf[DGST_R3]
352   };
353
354   /**
355    * salt
356    */
357
358   u32 s[8];
359
360   s[0] = salt_bufs[salt_pos].salt_buf_pc[0];
361   s[1] = salt_bufs[salt_pos].salt_buf_pc[1];
362   s[2] = salt_bufs[salt_pos].salt_buf_pc[2];
363   s[3] = salt_bufs[salt_pos].salt_buf_pc[3];
364   s[4] = salt_bufs[salt_pos].salt_buf_pc[4];
365   s[5] = salt_bufs[salt_pos].salt_buf_pc[5];
366   s[6] = salt_bufs[salt_pos].salt_buf_pc[6];
367   s[7] = salt_bufs[salt_pos].salt_buf_pc[7];
368
369   const u32 r_00 = 0x80;
370   const u32 r_14 = 64 * 8;
371
372   /**
373    * loop
374    */
375
376   u32 w0l = w0[0];
377
378   for (u32 il_pos = 0; il_pos < bfs_cnt; il_pos++)
379   {
380     const u32 w0r = bfs_buf[il_pos].i;
381
382     w0[0] = w0l | w0r;
383
384     u32 a = MD5M_A;
385     u32 b = MD5M_B;
386     u32 c = MD5M_C;
387     u32 d = MD5M_D;
388
389     MD5_STEP (MD5_Fo, a, b, c, d, w0[0], MD5C00, MD5S00);
390     MD5_STEP (MD5_Fo, d, a, b, c, w0[1], MD5C01, MD5S01);
391     MD5_STEP (MD5_Fo, c, d, a, b, w0[2], MD5C02, MD5S02);
392     MD5_STEP (MD5_Fo, b, c, d, a, w0[3], MD5C03, MD5S03);
393     MD5_STEP (MD5_Fo, a, b, c, d, w1[0], MD5C04, MD5S00);
394     MD5_STEP (MD5_Fo, d, a, b, c, w1[1], MD5C05, MD5S01);
395     MD5_STEP (MD5_Fo, c, d, a, b, w1[2], MD5C06, MD5S02);
396     MD5_STEP (MD5_Fo, b, c, d, a, w1[3], MD5C07, MD5S03);
397     MD5_STEP (MD5_Fo, a, b, c, d, w2[0], MD5C08, MD5S00);
398     MD5_STEP (MD5_Fo, d, a, b, c, w2[1], MD5C09, MD5S01);
399     MD5_STEP (MD5_Fo, c, d, a, b, w2[2], MD5C0a, MD5S02);
400     MD5_STEP (MD5_Fo, b, c, d, a, w2[3], MD5C0b, MD5S03);
401     MD5_STEP (MD5_Fo, a, b, c, d, w3[0], MD5C0c, MD5S00);
402     MD5_STEP (MD5_Fo, d, a, b, c, w3[1], MD5C0d, MD5S01);
403     MD5_STEP (MD5_Fo, c, d, a, b, w3[2], MD5C0e, MD5S02);
404     MD5_STEP (MD5_Fo, b, c, d, a, w3[3], MD5C0f, MD5S03);
405
406     MD5_STEP (MD5_Go, a, b, c, d, w0[1], MD5C10, MD5S10);
407     MD5_STEP (MD5_Go, d, a, b, c, w1[2], MD5C11, MD5S11);
408     MD5_STEP (MD5_Go, c, d, a, b, w2[3], MD5C12, MD5S12);
409     MD5_STEP (MD5_Go, b, c, d, a, w0[0], MD5C13, MD5S13);
410     MD5_STEP (MD5_Go, a, b, c, d, w1[1], MD5C14, MD5S10);
411     MD5_STEP (MD5_Go, d, a, b, c, w2[2], MD5C15, MD5S11);
412     MD5_STEP (MD5_Go, c, d, a, b, w3[3], MD5C16, MD5S12);
413     MD5_STEP (MD5_Go, b, c, d, a, w1[0], MD5C17, MD5S13);
414     MD5_STEP (MD5_Go, a, b, c, d, w2[1], MD5C18, MD5S10);
415     MD5_STEP (MD5_Go, d, a, b, c, w3[2], MD5C19, MD5S11);
416     MD5_STEP (MD5_Go, c, d, a, b, w0[3], MD5C1a, MD5S12);
417     MD5_STEP (MD5_Go, b, c, d, a, w2[0], MD5C1b, MD5S13);
418     MD5_STEP (MD5_Go, a, b, c, d, w3[1], MD5C1c, MD5S10);
419     MD5_STEP (MD5_Go, d, a, b, c, w0[2], MD5C1d, MD5S11);
420     MD5_STEP (MD5_Go, c, d, a, b, w1[3], MD5C1e, MD5S12);
421     MD5_STEP (MD5_Go, b, c, d, a, w3[0], MD5C1f, MD5S13);
422
423     MD5_STEP (MD5_H , a, b, c, d, w1[1], MD5C20, MD5S20);
424     MD5_STEP (MD5_H , d, a, b, c, w2[0], MD5C21, MD5S21);
425     MD5_STEP (MD5_H , c, d, a, b, w2[3], MD5C22, MD5S22);
426     MD5_STEP (MD5_H , b, c, d, a, w3[2], MD5C23, MD5S23);
427     MD5_STEP (MD5_H , a, b, c, d, w0[1], MD5C24, MD5S20);
428     MD5_STEP (MD5_H , d, a, b, c, w1[0], MD5C25, MD5S21);
429     MD5_STEP (MD5_H , c, d, a, b, w1[3], MD5C26, MD5S22);
430     MD5_STEP (MD5_H , b, c, d, a, w2[2], MD5C27, MD5S23);
431     MD5_STEP (MD5_H , a, b, c, d, w3[1], MD5C28, MD5S20);
432     MD5_STEP (MD5_H , d, a, b, c, w0[0], MD5C29, MD5S21);
433     MD5_STEP (MD5_H , c, d, a, b, w0[3], MD5C2a, MD5S22);
434     MD5_STEP (MD5_H , b, c, d, a, w1[2], MD5C2b, MD5S23);
435     MD5_STEP (MD5_H , a, b, c, d, w2[1], MD5C2c, MD5S20);
436     MD5_STEP (MD5_H , d, a, b, c, w3[0], MD5C2d, MD5S21);
437     MD5_STEP (MD5_H , c, d, a, b, w3[3], MD5C2e, MD5S22);
438     MD5_STEP (MD5_H , b, c, d, a, w0[2], MD5C2f, MD5S23);
439
440     MD5_STEP (MD5_I , a, b, c, d, w0[0], MD5C30, MD5S30);
441     MD5_STEP (MD5_I , d, a, b, c, w1[3], MD5C31, MD5S31);
442     MD5_STEP (MD5_I , c, d, a, b, w3[2], MD5C32, MD5S32);
443     MD5_STEP (MD5_I , b, c, d, a, w1[1], MD5C33, MD5S33);
444     MD5_STEP (MD5_I , a, b, c, d, w3[0], MD5C34, MD5S30);
445     MD5_STEP (MD5_I , d, a, b, c, w0[3], MD5C35, MD5S31);
446     MD5_STEP (MD5_I , c, d, a, b, w2[2], MD5C36, MD5S32);
447     MD5_STEP (MD5_I , b, c, d, a, w0[1], MD5C37, MD5S33);
448     MD5_STEP (MD5_I , a, b, c, d, w2[0], MD5C38, MD5S30);
449     MD5_STEP (MD5_I , d, a, b, c, w3[3], MD5C39, MD5S31);
450     MD5_STEP (MD5_I , c, d, a, b, w1[2], MD5C3a, MD5S32);
451     MD5_STEP (MD5_I , b, c, d, a, w3[1], MD5C3b, MD5S33);
452     MD5_STEP (MD5_I , a, b, c, d, w1[0], MD5C3c, MD5S30);
453     MD5_STEP (MD5_I , d, a, b, c, w2[3], MD5C3d, MD5S31);
454     MD5_STEP (MD5_I , c, d, a, b, w0[2], MD5C3e, MD5S32);
455     MD5_STEP (MD5_I , b, c, d, a, w2[1], MD5C3f, MD5S33);
456
457     a += MD5M_A;
458     b += MD5M_B;
459     c += MD5M_C;
460     d += MD5M_D;
461
462     const u32  w0_t = s[0];
463     const u32  w1_t = s[1];
464     const u32  w2_t = s[2];
465     const u32  w3_t = s[3];
466     const u32  w4_t = s[4];
467     const u32  w5_t = s[5];
468     const u32  w6_t = s[6];
469     const u32  w7_t = s[7];
470
471     const u32 w8_t = uint_to_hex_lower8 ((a >>  0) & 255) <<  0
472                      | uint_to_hex_lower8 ((a >>  8) & 255) << 16;
473     const u32 w9_t = uint_to_hex_lower8 ((a >> 16) & 255) <<  0
474                      | uint_to_hex_lower8 ((a >> 24) & 255) << 16;
475     const u32 wa_t = uint_to_hex_lower8 ((b >>  0) & 255) <<  0
476                      | uint_to_hex_lower8 ((b >>  8) & 255) << 16;
477     const u32 wb_t = uint_to_hex_lower8 ((b >> 16) & 255) <<  0
478                      | uint_to_hex_lower8 ((b >> 24) & 255) << 16;
479     const u32 wc_t = uint_to_hex_lower8 ((c >>  0) & 255) <<  0
480                      | uint_to_hex_lower8 ((c >>  8) & 255) << 16;
481     const u32 wd_t = uint_to_hex_lower8 ((c >> 16) & 255) <<  0
482                      | uint_to_hex_lower8 ((c >> 24) & 255) << 16;
483     const u32 we_t = uint_to_hex_lower8 ((d >>  0) & 255) <<  0
484                      | uint_to_hex_lower8 ((d >>  8) & 255) << 16;
485     const u32 wf_t = uint_to_hex_lower8 ((d >> 16) & 255) <<  0
486                      | uint_to_hex_lower8 ((d >> 24) & 255) << 16;
487
488     a = MD5M_A;
489     b = MD5M_B;
490     c = MD5M_C;
491     d = MD5M_D;
492
493     MD5_STEP (MD5_Fo, a, b, c, d, w0_t, MD5C00, MD5S00);
494     MD5_STEP (MD5_Fo, d, a, b, c, w1_t, MD5C01, MD5S01);
495     MD5_STEP (MD5_Fo, c, d, a, b, w2_t, MD5C02, MD5S02);
496     MD5_STEP (MD5_Fo, b, c, d, a, w3_t, MD5C03, MD5S03);
497     MD5_STEP (MD5_Fo, a, b, c, d, w4_t, MD5C04, MD5S00);
498     MD5_STEP (MD5_Fo, d, a, b, c, w5_t, MD5C05, MD5S01);
499     MD5_STEP (MD5_Fo, c, d, a, b, w6_t, MD5C06, MD5S02);
500     MD5_STEP (MD5_Fo, b, c, d, a, w7_t, MD5C07, MD5S03);
501     MD5_STEP (MD5_Fo, a, b, c, d, w8_t, MD5C08, MD5S00);
502     MD5_STEP (MD5_Fo, d, a, b, c, w9_t, MD5C09, MD5S01);
503     MD5_STEP (MD5_Fo, c, d, a, b, wa_t, MD5C0a, MD5S02);
504     MD5_STEP (MD5_Fo, b, c, d, a, wb_t, MD5C0b, MD5S03);
505     MD5_STEP (MD5_Fo, a, b, c, d, wc_t, MD5C0c, MD5S00);
506     MD5_STEP (MD5_Fo, d, a, b, c, wd_t, MD5C0d, MD5S01);
507     MD5_STEP (MD5_Fo, c, d, a, b, we_t, MD5C0e, MD5S02);
508     MD5_STEP (MD5_Fo, b, c, d, a, wf_t, MD5C0f, MD5S03);
509
510     MD5_STEP (MD5_Go, a, b, c, d, w1_t, MD5C10, MD5S10);
511     MD5_STEP (MD5_Go, d, a, b, c, w6_t, MD5C11, MD5S11);
512     MD5_STEP (MD5_Go, c, d, a, b, wb_t, MD5C12, MD5S12);
513     MD5_STEP (MD5_Go, b, c, d, a, w0_t, MD5C13, MD5S13);
514     MD5_STEP (MD5_Go, a, b, c, d, w5_t, MD5C14, MD5S10);
515     MD5_STEP (MD5_Go, d, a, b, c, wa_t, MD5C15, MD5S11);
516     MD5_STEP (MD5_Go, c, d, a, b, wf_t, MD5C16, MD5S12);
517     MD5_STEP (MD5_Go, b, c, d, a, w4_t, MD5C17, MD5S13);
518     MD5_STEP (MD5_Go, a, b, c, d, w9_t, MD5C18, MD5S10);
519     MD5_STEP (MD5_Go, d, a, b, c, we_t, MD5C19, MD5S11);
520     MD5_STEP (MD5_Go, c, d, a, b, w3_t, MD5C1a, MD5S12);
521     MD5_STEP (MD5_Go, b, c, d, a, w8_t, MD5C1b, MD5S13);
522     MD5_STEP (MD5_Go, a, b, c, d, wd_t, MD5C1c, MD5S10);
523     MD5_STEP (MD5_Go, d, a, b, c, w2_t, MD5C1d, MD5S11);
524     MD5_STEP (MD5_Go, c, d, a, b, w7_t, MD5C1e, MD5S12);
525     MD5_STEP (MD5_Go, b, c, d, a, wc_t, MD5C1f, MD5S13);
526
527     MD5_STEP (MD5_H , a, b, c, d, w5_t, MD5C20, MD5S20);
528     MD5_STEP (MD5_H , d, a, b, c, w8_t, MD5C21, MD5S21);
529     MD5_STEP (MD5_H , c, d, a, b, wb_t, MD5C22, MD5S22);
530     MD5_STEP (MD5_H , b, c, d, a, we_t, MD5C23, MD5S23);
531     MD5_STEP (MD5_H , a, b, c, d, w1_t, MD5C24, MD5S20);
532     MD5_STEP (MD5_H , d, a, b, c, w4_t, MD5C25, MD5S21);
533     MD5_STEP (MD5_H , c, d, a, b, w7_t, MD5C26, MD5S22);
534     MD5_STEP (MD5_H , b, c, d, a, wa_t, MD5C27, MD5S23);
535     MD5_STEP (MD5_H , a, b, c, d, wd_t, MD5C28, MD5S20);
536     MD5_STEP (MD5_H , d, a, b, c, w0_t, MD5C29, MD5S21);
537     MD5_STEP (MD5_H , c, d, a, b, w3_t, MD5C2a, MD5S22);
538     MD5_STEP (MD5_H , b, c, d, a, w6_t, MD5C2b, MD5S23);
539     MD5_STEP (MD5_H , a, b, c, d, w9_t, MD5C2c, MD5S20);
540     MD5_STEP (MD5_H , d, a, b, c, wc_t, MD5C2d, MD5S21);
541     MD5_STEP (MD5_H , c, d, a, b, wf_t, MD5C2e, MD5S22);
542     MD5_STEP (MD5_H , b, c, d, a, w2_t, MD5C2f, MD5S23);
543
544     MD5_STEP (MD5_I , a, b, c, d, w0_t, MD5C30, MD5S30);
545     MD5_STEP (MD5_I , d, a, b, c, w7_t, MD5C31, MD5S31);
546     MD5_STEP (MD5_I , c, d, a, b, we_t, MD5C32, MD5S32);
547     MD5_STEP (MD5_I , b, c, d, a, w5_t, MD5C33, MD5S33);
548     MD5_STEP (MD5_I , a, b, c, d, wc_t, MD5C34, MD5S30);
549     MD5_STEP (MD5_I , d, a, b, c, w3_t, MD5C35, MD5S31);
550     MD5_STEP (MD5_I , c, d, a, b, wa_t, MD5C36, MD5S32);
551     MD5_STEP (MD5_I , b, c, d, a, w1_t, MD5C37, MD5S33);
552     MD5_STEP (MD5_I , a, b, c, d, w8_t, MD5C38, MD5S30);
553     MD5_STEP (MD5_I , d, a, b, c, wf_t, MD5C39, MD5S31);
554     MD5_STEP (MD5_I , c, d, a, b, w6_t, MD5C3a, MD5S32);
555     MD5_STEP (MD5_I , b, c, d, a, wd_t, MD5C3b, MD5S33);
556     MD5_STEP (MD5_I , a, b, c, d, w4_t, MD5C3c, MD5S30);
557     MD5_STEP (MD5_I , d, a, b, c, wb_t, MD5C3d, MD5S31);
558     MD5_STEP (MD5_I , c, d, a, b, w2_t, MD5C3e, MD5S32);
559     MD5_STEP (MD5_I , b, c, d, a, w9_t, MD5C3f, MD5S33);
560
561     const u32 r_a = a + MD5M_A;
562     const u32 r_b = b + MD5M_B;
563     const u32 r_c = c + MD5M_C;
564     const u32 r_d = d + MD5M_D;
565
566     a = r_a;
567     b = r_b;
568     c = r_c;
569     d = r_d;
570
571     MD5_STEP (MD5_Fo, a, b, c, d, r_00, MD5C00, MD5S00);
572     MD5_STEP0(MD5_Fo, d, a, b, c,       MD5C01, MD5S01);
573     MD5_STEP0(MD5_Fo, c, d, a, b,       MD5C02, MD5S02);
574     MD5_STEP0(MD5_Fo, b, c, d, a,       MD5C03, MD5S03);
575     MD5_STEP0(MD5_Fo, a, b, c, d,       MD5C04, MD5S00);
576     MD5_STEP0(MD5_Fo, d, a, b, c,       MD5C05, MD5S01);
577     MD5_STEP0(MD5_Fo, c, d, a, b,       MD5C06, MD5S02);
578     MD5_STEP0(MD5_Fo, b, c, d, a,       MD5C07, MD5S03);
579     MD5_STEP0(MD5_Fo, a, b, c, d,       MD5C08, MD5S00);
580     MD5_STEP0(MD5_Fo, d, a, b, c,       MD5C09, MD5S01);
581     MD5_STEP0(MD5_Fo, c, d, a, b,       MD5C0a, MD5S02);
582     MD5_STEP0(MD5_Fo, b, c, d, a,       MD5C0b, MD5S03);
583     MD5_STEP0(MD5_Fo, a, b, c, d,       MD5C0c, MD5S00);
584     MD5_STEP0(MD5_Fo, d, a, b, c,       MD5C0d, MD5S01);
585     MD5_STEP (MD5_Fo, c, d, a, b, r_14, MD5C0e, MD5S02);
586     MD5_STEP0(MD5_Fo, b, c, d, a,       MD5C0f, MD5S03);
587
588     MD5_STEP0(MD5_Go, a, b, c, d,       MD5C10, MD5S10);
589     MD5_STEP0(MD5_Go, d, a, b, c,       MD5C11, MD5S11);
590     MD5_STEP0(MD5_Go, c, d, a, b,       MD5C12, MD5S12);
591     MD5_STEP (MD5_Go, b, c, d, a, r_00, MD5C13, MD5S13);
592     MD5_STEP0(MD5_Go, a, b, c, d,       MD5C14, MD5S10);
593     MD5_STEP0(MD5_Go, d, a, b, c,       MD5C15, MD5S11);
594     MD5_STEP0(MD5_Go, c, d, a, b,       MD5C16, MD5S12);
595     MD5_STEP0(MD5_Go, b, c, d, a,       MD5C17, MD5S13);
596     MD5_STEP0(MD5_Go, a, b, c, d,       MD5C18, MD5S10);
597     MD5_STEP (MD5_Go, d, a, b, c, r_14, MD5C19, MD5S11);
598     MD5_STEP0(MD5_Go, c, d, a, b,       MD5C1a, MD5S12);
599     MD5_STEP0(MD5_Go, b, c, d, a,       MD5C1b, MD5S13);
600     MD5_STEP0(MD5_Go, a, b, c, d,       MD5C1c, MD5S10);
601     MD5_STEP0(MD5_Go, d, a, b, c,       MD5C1d, MD5S11);
602     MD5_STEP0(MD5_Go, c, d, a, b,       MD5C1e, MD5S12);
603     MD5_STEP0(MD5_Go, b, c, d, a,       MD5C1f, MD5S13);
604
605     MD5_STEP0(MD5_H , a, b, c, d,       MD5C20, MD5S20);
606     MD5_STEP0(MD5_H , d, a, b, c,       MD5C21, MD5S21);
607     MD5_STEP0(MD5_H , c, d, a, b,       MD5C22, MD5S22);
608     MD5_STEP (MD5_H , b, c, d, a, r_14, MD5C23, MD5S23);
609     MD5_STEP0(MD5_H , a, b, c, d,       MD5C24, MD5S20);
610     MD5_STEP0(MD5_H , d, a, b, c,       MD5C25, MD5S21);
611     MD5_STEP0(MD5_H , c, d, a, b,       MD5C26, MD5S22);
612     MD5_STEP0(MD5_H , b, c, d, a,       MD5C27, MD5S23);
613     MD5_STEP0(MD5_H , a, b, c, d,       MD5C28, MD5S20);
614     MD5_STEP (MD5_H , d, a, b, c, r_00, MD5C29, MD5S21);
615     MD5_STEP0(MD5_H , c, d, a, b,       MD5C2a, MD5S22);
616     MD5_STEP0(MD5_H , b, c, d, a,       MD5C2b, MD5S23);
617     MD5_STEP0(MD5_H , a, b, c, d,       MD5C2c, MD5S20);
618     MD5_STEP0(MD5_H , d, a, b, c,       MD5C2d, MD5S21);
619     MD5_STEP0(MD5_H , c, d, a, b,       MD5C2e, MD5S22);
620     MD5_STEP0(MD5_H , b, c, d, a,       MD5C2f, MD5S23);
621
622     MD5_STEP (MD5_I , a, b, c, d, r_00, MD5C30, MD5S30);
623     MD5_STEP0(MD5_I , d, a, b, c,       MD5C31, MD5S31);
624     MD5_STEP (MD5_I , c, d, a, b, r_14, MD5C32, MD5S32);
625     MD5_STEP0(MD5_I , b, c, d, a,       MD5C33, MD5S33);
626     MD5_STEP0(MD5_I , a, b, c, d,       MD5C34, MD5S30);
627     MD5_STEP0(MD5_I , d, a, b, c,       MD5C35, MD5S31);
628     MD5_STEP0(MD5_I , c, d, a, b,       MD5C36, MD5S32);
629     MD5_STEP0(MD5_I , b, c, d, a,       MD5C37, MD5S33);
630     MD5_STEP0(MD5_I , a, b, c, d,       MD5C38, MD5S30);
631     MD5_STEP0(MD5_I , d, a, b, c,       MD5C39, MD5S31);
632     MD5_STEP0(MD5_I , c, d, a, b,       MD5C3a, MD5S32);
633     MD5_STEP0(MD5_I , b, c, d, a,       MD5C3b, MD5S33);
634     MD5_STEP0(MD5_I , a, b, c, d,       MD5C3c, MD5S30);
635
636     if (allx ((a + r_a) != search[0])) continue;
637
638     MD5_STEP0(MD5_I , d, a, b, c,       MD5C3d, MD5S31);
639     MD5_STEP0(MD5_I , c, d, a, b,       MD5C3e, MD5S32);
640     MD5_STEP0(MD5_I , b, c, d, a,       MD5C3f, MD5S33);
641
642     a += r_a;
643     b += r_b;
644     c += r_c;
645     d += r_d;
646
647     const u32 r0 = a;
648     const u32 r1 = d;
649     const u32 r2 = c;
650     const u32 r3 = b;
651
652     #include COMPARE_S
653   }
654 }
655
656 __kernel void __attribute__((reqd_work_group_size (64, 1, 1))) m02810_m04 (__global pw_t *pws, __global gpu_rule_t *rules_buf, __global comb_t *combs_buf, __global bf_t *bfs_buf, __global void *tmps, __global void *hooks, __global u32 *bitmaps_buf_s1_a, __global u32 *bitmaps_buf_s1_b, __global u32 *bitmaps_buf_s1_c, __global u32 *bitmaps_buf_s1_d, __global u32 *bitmaps_buf_s2_a, __global u32 *bitmaps_buf_s2_b, __global u32 *bitmaps_buf_s2_c, __global u32 *bitmaps_buf_s2_d, __global plain_t *plains_buf, __global digest_t *digests_buf, __global u32 *hashes_shown, __global salt_t *salt_bufs, __global void *esalt_bufs, __global u32 *d_return_buf, __global 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)
657 {
658   /**
659    * base
660    */
661
662   const u32 gid = get_global_id (0);
663
664   /**
665    * modifier
666    */
667
668   const u32 lid = get_local_id (0);
669
670
671   u32 w0[4];
672
673   w0[0] = pws[gid].i[ 0];
674   w0[1] = pws[gid].i[ 1];
675   w0[2] = pws[gid].i[ 2];
676   w0[3] = pws[gid].i[ 3];
677
678   u32 w1[4];
679
680   w1[0] = 0;
681   w1[1] = 0;
682   w1[2] = 0;
683   w1[3] = 0;
684
685   u32 w2[4];
686
687   w2[0] = 0;
688   w2[1] = 0;
689   w2[2] = 0;
690   w2[3] = 0;
691
692   u32 w3[4];
693
694   w3[0] = 0;
695   w3[1] = 0;
696   w3[2] = pws[gid].i[14];
697   w3[3] = 0;
698
699   const u32 pw_len = pws[gid].pw_len;
700
701   /**
702    * bin2asc table
703    */
704
705   __local u32 l_bin2asc[256];
706
707   const u32 lid4 = lid * 4;
708
709   const u32 lid40 = lid4 + 0;
710   const u32 lid41 = lid4 + 1;
711   const u32 lid42 = lid4 + 2;
712   const u32 lid43 = lid4 + 3;
713
714   const u32 v400 = (lid40 >> 0) & 15;
715   const u32 v401 = (lid40 >> 4) & 15;
716   const u32 v410 = (lid41 >> 0) & 15;
717   const u32 v411 = (lid41 >> 4) & 15;
718   const u32 v420 = (lid42 >> 0) & 15;
719   const u32 v421 = (lid42 >> 4) & 15;
720   const u32 v430 = (lid43 >> 0) & 15;
721   const u32 v431 = (lid43 >> 4) & 15;
722
723   l_bin2asc[lid40] = ((v400 < 10) ? '0' + v400 : 'a' - 10 + v400) << 8
724                    | ((v401 < 10) ? '0' + v401 : 'a' - 10 + v401) << 0;
725   l_bin2asc[lid41] = ((v410 < 10) ? '0' + v410 : 'a' - 10 + v410) << 8
726                    | ((v411 < 10) ? '0' + v411 : 'a' - 10 + v411) << 0;
727   l_bin2asc[lid42] = ((v420 < 10) ? '0' + v420 : 'a' - 10 + v420) << 8
728                    | ((v421 < 10) ? '0' + v421 : 'a' - 10 + v421) << 0;
729   l_bin2asc[lid43] = ((v430 < 10) ? '0' + v430 : 'a' - 10 + v430) << 8
730                    | ((v431 < 10) ? '0' + v431 : 'a' - 10 + v431) << 0;
731
732   barrier (CLK_LOCAL_MEM_FENCE);
733
734   if (gid >= gid_max) return;
735
736   /**
737    * main
738    */
739
740   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, l_bin2asc);
741 }
742
743 __kernel void __attribute__((reqd_work_group_size (64, 1, 1))) m02810_m08 (__global pw_t *pws, __global gpu_rule_t *rules_buf, __global comb_t *combs_buf, __global bf_t *bfs_buf, __global void *tmps, __global void *hooks, __global u32 *bitmaps_buf_s1_a, __global u32 *bitmaps_buf_s1_b, __global u32 *bitmaps_buf_s1_c, __global u32 *bitmaps_buf_s1_d, __global u32 *bitmaps_buf_s2_a, __global u32 *bitmaps_buf_s2_b, __global u32 *bitmaps_buf_s2_c, __global u32 *bitmaps_buf_s2_d, __global plain_t *plains_buf, __global digest_t *digests_buf, __global u32 *hashes_shown, __global salt_t *salt_bufs, __global void *esalt_bufs, __global u32 *d_return_buf, __global 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)
744 {
745   /**
746    * base
747    */
748
749   const u32 gid = get_global_id (0);
750
751   /**
752    * modifier
753    */
754
755   const u32 lid = get_local_id (0);
756
757   u32 w0[4];
758
759   w0[0] = pws[gid].i[ 0];
760   w0[1] = pws[gid].i[ 1];
761   w0[2] = pws[gid].i[ 2];
762   w0[3] = pws[gid].i[ 3];
763
764   u32 w1[4];
765
766   w1[0] = pws[gid].i[ 4];
767   w1[1] = pws[gid].i[ 5];
768   w1[2] = pws[gid].i[ 6];
769   w1[3] = pws[gid].i[ 7];
770
771   u32 w2[4];
772
773   w2[0] = 0;
774   w2[1] = 0;
775   w2[2] = 0;
776   w2[3] = 0;
777
778   u32 w3[4];
779
780   w3[0] = 0;
781   w3[1] = 0;
782   w3[2] = pws[gid].i[14];
783   w3[3] = 0;
784
785   const u32 pw_len = pws[gid].pw_len;
786
787   /**
788    * bin2asc table
789    */
790
791   __local u32 l_bin2asc[256];
792
793   const u32 lid4 = lid * 4;
794
795   const u32 lid40 = lid4 + 0;
796   const u32 lid41 = lid4 + 1;
797   const u32 lid42 = lid4 + 2;
798   const u32 lid43 = lid4 + 3;
799
800   const u32 v400 = (lid40 >> 0) & 15;
801   const u32 v401 = (lid40 >> 4) & 15;
802   const u32 v410 = (lid41 >> 0) & 15;
803   const u32 v411 = (lid41 >> 4) & 15;
804   const u32 v420 = (lid42 >> 0) & 15;
805   const u32 v421 = (lid42 >> 4) & 15;
806   const u32 v430 = (lid43 >> 0) & 15;
807   const u32 v431 = (lid43 >> 4) & 15;
808
809   l_bin2asc[lid40] = ((v400 < 10) ? '0' + v400 : 'a' - 10 + v400) << 8
810                    | ((v401 < 10) ? '0' + v401 : 'a' - 10 + v401) << 0;
811   l_bin2asc[lid41] = ((v410 < 10) ? '0' + v410 : 'a' - 10 + v410) << 8
812                    | ((v411 < 10) ? '0' + v411 : 'a' - 10 + v411) << 0;
813   l_bin2asc[lid42] = ((v420 < 10) ? '0' + v420 : 'a' - 10 + v420) << 8
814                    | ((v421 < 10) ? '0' + v421 : 'a' - 10 + v421) << 0;
815   l_bin2asc[lid43] = ((v430 < 10) ? '0' + v430 : 'a' - 10 + v430) << 8
816                    | ((v431 < 10) ? '0' + v431 : 'a' - 10 + v431) << 0;
817
818   barrier (CLK_LOCAL_MEM_FENCE);
819
820   if (gid >= gid_max) return;
821
822   /**
823    * main
824    */
825
826   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, l_bin2asc);
827 }
828
829 __kernel void __attribute__((reqd_work_group_size (64, 1, 1))) m02810_m16 (__global pw_t *pws, __global gpu_rule_t *rules_buf, __global comb_t *combs_buf, __global bf_t *bfs_buf, __global void *tmps, __global void *hooks, __global u32 *bitmaps_buf_s1_a, __global u32 *bitmaps_buf_s1_b, __global u32 *bitmaps_buf_s1_c, __global u32 *bitmaps_buf_s1_d, __global u32 *bitmaps_buf_s2_a, __global u32 *bitmaps_buf_s2_b, __global u32 *bitmaps_buf_s2_c, __global u32 *bitmaps_buf_s2_d, __global plain_t *plains_buf, __global digest_t *digests_buf, __global u32 *hashes_shown, __global salt_t *salt_bufs, __global void *esalt_bufs, __global u32 *d_return_buf, __global 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)
830 {
831   /**
832    * base
833    */
834
835   const u32 gid = get_global_id (0);
836
837   /**
838    * modifier
839    */
840
841   const u32 lid = get_local_id (0);
842
843   u32 w0[4];
844
845   w0[0] = pws[gid].i[ 0];
846   w0[1] = pws[gid].i[ 1];
847   w0[2] = pws[gid].i[ 2];
848   w0[3] = pws[gid].i[ 3];
849
850   u32 w1[4];
851
852   w1[0] = pws[gid].i[ 4];
853   w1[1] = pws[gid].i[ 5];
854   w1[2] = pws[gid].i[ 6];
855   w1[3] = pws[gid].i[ 7];
856
857   u32 w2[4];
858
859   w2[0] = pws[gid].i[ 8];
860   w2[1] = pws[gid].i[ 9];
861   w2[2] = pws[gid].i[10];
862   w2[3] = pws[gid].i[11];
863
864   u32 w3[4];
865
866   w3[0] = pws[gid].i[12];
867   w3[1] = pws[gid].i[13];
868   w3[2] = pws[gid].i[14];
869   w3[3] = pws[gid].i[15];
870
871   const u32 pw_len = pws[gid].pw_len;
872
873   /**
874    * bin2asc table
875    */
876
877   __local u32 l_bin2asc[256];
878
879   const u32 lid4 = lid * 4;
880
881   const u32 lid40 = lid4 + 0;
882   const u32 lid41 = lid4 + 1;
883   const u32 lid42 = lid4 + 2;
884   const u32 lid43 = lid4 + 3;
885
886   const u32 v400 = (lid40 >> 0) & 15;
887   const u32 v401 = (lid40 >> 4) & 15;
888   const u32 v410 = (lid41 >> 0) & 15;
889   const u32 v411 = (lid41 >> 4) & 15;
890   const u32 v420 = (lid42 >> 0) & 15;
891   const u32 v421 = (lid42 >> 4) & 15;
892   const u32 v430 = (lid43 >> 0) & 15;
893   const u32 v431 = (lid43 >> 4) & 15;
894
895   l_bin2asc[lid40] = ((v400 < 10) ? '0' + v400 : 'a' - 10 + v400) << 8
896                    | ((v401 < 10) ? '0' + v401 : 'a' - 10 + v401) << 0;
897   l_bin2asc[lid41] = ((v410 < 10) ? '0' + v410 : 'a' - 10 + v410) << 8
898                    | ((v411 < 10) ? '0' + v411 : 'a' - 10 + v411) << 0;
899   l_bin2asc[lid42] = ((v420 < 10) ? '0' + v420 : 'a' - 10 + v420) << 8
900                    | ((v421 < 10) ? '0' + v421 : 'a' - 10 + v421) << 0;
901   l_bin2asc[lid43] = ((v430 < 10) ? '0' + v430 : 'a' - 10 + v430) << 8
902                    | ((v431 < 10) ? '0' + v431 : 'a' - 10 + v431) << 0;
903
904   barrier (CLK_LOCAL_MEM_FENCE);
905
906   if (gid >= gid_max) return;
907
908   /**
909    * main
910    */
911
912   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, l_bin2asc);
913 }
914
915 __kernel void __attribute__((reqd_work_group_size (64, 1, 1))) m02810_s04 (__global pw_t *pws, __global gpu_rule_t *rules_buf, __global comb_t *combs_buf, __global bf_t *bfs_buf, __global void *tmps, __global void *hooks, __global u32 *bitmaps_buf_s1_a, __global u32 *bitmaps_buf_s1_b, __global u32 *bitmaps_buf_s1_c, __global u32 *bitmaps_buf_s1_d, __global u32 *bitmaps_buf_s2_a, __global u32 *bitmaps_buf_s2_b, __global u32 *bitmaps_buf_s2_c, __global u32 *bitmaps_buf_s2_d, __global plain_t *plains_buf, __global digest_t *digests_buf, __global u32 *hashes_shown, __global salt_t *salt_bufs, __global void *esalt_bufs, __global u32 *d_return_buf, __global 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)
916 {
917   /**
918    * base
919    */
920
921   const u32 gid = get_global_id (0);
922
923   /**
924    * modifier
925    */
926
927   const u32 lid = get_local_id (0);
928
929   u32 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   u32 w1[4];
937
938   w1[0] = 0;
939   w1[1] = 0;
940   w1[2] = 0;
941   w1[3] = 0;
942
943   u32 w2[4];
944
945   w2[0] = 0;
946   w2[1] = 0;
947   w2[2] = 0;
948   w2[3] = 0;
949
950   u32 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   __local u32 l_bin2asc[256];
964
965   const u32 lid4 = lid * 4;
966
967   const u32 lid40 = lid4 + 0;
968   const u32 lid41 = lid4 + 1;
969   const u32 lid42 = lid4 + 2;
970   const u32 lid43 = lid4 + 3;
971
972   const u32 v400 = (lid40 >> 0) & 15;
973   const u32 v401 = (lid40 >> 4) & 15;
974   const u32 v410 = (lid41 >> 0) & 15;
975   const u32 v411 = (lid41 >> 4) & 15;
976   const u32 v420 = (lid42 >> 0) & 15;
977   const u32 v421 = (lid42 >> 4) & 15;
978   const u32 v430 = (lid43 >> 0) & 15;
979   const u32 v431 = (lid43 >> 4) & 15;
980
981   l_bin2asc[lid40] = ((v400 < 10) ? '0' + v400 : 'a' - 10 + v400) << 8
982                    | ((v401 < 10) ? '0' + v401 : 'a' - 10 + v401) << 0;
983   l_bin2asc[lid41] = ((v410 < 10) ? '0' + v410 : 'a' - 10 + v410) << 8
984                    | ((v411 < 10) ? '0' + v411 : 'a' - 10 + v411) << 0;
985   l_bin2asc[lid42] = ((v420 < 10) ? '0' + v420 : 'a' - 10 + v420) << 8
986                    | ((v421 < 10) ? '0' + v421 : 'a' - 10 + v421) << 0;
987   l_bin2asc[lid43] = ((v430 < 10) ? '0' + v430 : 'a' - 10 + v430) << 8
988                    | ((v431 < 10) ? '0' + v431 : 'a' - 10 + v431) << 0;
989
990   barrier (CLK_LOCAL_MEM_FENCE);
991
992   if (gid >= gid_max) return;
993
994   /**
995    * main
996    */
997
998   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, l_bin2asc);
999 }
1000
1001 __kernel void __attribute__((reqd_work_group_size (64, 1, 1))) m02810_s08 (__global pw_t *pws, __global gpu_rule_t *rules_buf, __global comb_t *combs_buf, __global bf_t *bfs_buf, __global void *tmps, __global void *hooks, __global u32 *bitmaps_buf_s1_a, __global u32 *bitmaps_buf_s1_b, __global u32 *bitmaps_buf_s1_c, __global u32 *bitmaps_buf_s1_d, __global u32 *bitmaps_buf_s2_a, __global u32 *bitmaps_buf_s2_b, __global u32 *bitmaps_buf_s2_c, __global u32 *bitmaps_buf_s2_d, __global plain_t *plains_buf, __global digest_t *digests_buf, __global u32 *hashes_shown, __global salt_t *salt_bufs, __global void *esalt_bufs, __global u32 *d_return_buf, __global 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)
1002 {
1003   /**
1004    * base
1005    */
1006
1007   const u32 gid = get_global_id (0);
1008
1009   /**
1010    * modifier
1011    */
1012
1013   const u32 lid = get_local_id (0);
1014
1015   u32 w0[4];
1016
1017   w0[0] = pws[gid].i[ 0];
1018   w0[1] = pws[gid].i[ 1];
1019   w0[2] = pws[gid].i[ 2];
1020   w0[3] = pws[gid].i[ 3];
1021
1022   u32 w1[4];
1023
1024   w1[0] = pws[gid].i[ 4];
1025   w1[1] = pws[gid].i[ 5];
1026   w1[2] = pws[gid].i[ 6];
1027   w1[3] = pws[gid].i[ 7];
1028
1029   u32 w2[4];
1030
1031   w2[0] = 0;
1032   w2[1] = 0;
1033   w2[2] = 0;
1034   w2[3] = 0;
1035
1036   u32 w3[4];
1037
1038   w3[0] = 0;
1039   w3[1] = 0;
1040   w3[2] = pws[gid].i[14];
1041   w3[3] = 0;
1042
1043   const u32 pw_len = pws[gid].pw_len;
1044
1045   /**
1046    * bin2asc table
1047    */
1048
1049   __local u32 l_bin2asc[256];
1050
1051   const u32 lid4 = lid * 4;
1052
1053   const u32 lid40 = lid4 + 0;
1054   const u32 lid41 = lid4 + 1;
1055   const u32 lid42 = lid4 + 2;
1056   const u32 lid43 = lid4 + 3;
1057
1058   const u32 v400 = (lid40 >> 0) & 15;
1059   const u32 v401 = (lid40 >> 4) & 15;
1060   const u32 v410 = (lid41 >> 0) & 15;
1061   const u32 v411 = (lid41 >> 4) & 15;
1062   const u32 v420 = (lid42 >> 0) & 15;
1063   const u32 v421 = (lid42 >> 4) & 15;
1064   const u32 v430 = (lid43 >> 0) & 15;
1065   const u32 v431 = (lid43 >> 4) & 15;
1066
1067   l_bin2asc[lid40] = ((v400 < 10) ? '0' + v400 : 'a' - 10 + v400) << 8
1068                    | ((v401 < 10) ? '0' + v401 : 'a' - 10 + v401) << 0;
1069   l_bin2asc[lid41] = ((v410 < 10) ? '0' + v410 : 'a' - 10 + v410) << 8
1070                    | ((v411 < 10) ? '0' + v411 : 'a' - 10 + v411) << 0;
1071   l_bin2asc[lid42] = ((v420 < 10) ? '0' + v420 : 'a' - 10 + v420) << 8
1072                    | ((v421 < 10) ? '0' + v421 : 'a' - 10 + v421) << 0;
1073   l_bin2asc[lid43] = ((v430 < 10) ? '0' + v430 : 'a' - 10 + v430) << 8
1074                    | ((v431 < 10) ? '0' + v431 : 'a' - 10 + v431) << 0;
1075
1076   barrier (CLK_LOCAL_MEM_FENCE);
1077
1078   if (gid >= gid_max) return;
1079
1080   /**
1081    * main
1082    */
1083
1084   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, l_bin2asc);
1085 }
1086
1087 __kernel void __attribute__((reqd_work_group_size (64, 1, 1))) m02810_s16 (__global pw_t *pws, __global gpu_rule_t *rules_buf, __global comb_t *combs_buf, __global bf_t *bfs_buf, __global void *tmps, __global void *hooks, __global u32 *bitmaps_buf_s1_a, __global u32 *bitmaps_buf_s1_b, __global u32 *bitmaps_buf_s1_c, __global u32 *bitmaps_buf_s1_d, __global u32 *bitmaps_buf_s2_a, __global u32 *bitmaps_buf_s2_b, __global u32 *bitmaps_buf_s2_c, __global u32 *bitmaps_buf_s2_d, __global plain_t *plains_buf, __global digest_t *digests_buf, __global u32 *hashes_shown, __global salt_t *salt_bufs, __global void *esalt_bufs, __global u32 *d_return_buf, __global 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)
1088 {
1089   /**
1090    * base
1091    */
1092
1093   const u32 gid = get_global_id (0);
1094
1095   /**
1096    * modifier
1097    */
1098
1099   const u32 lid = get_local_id (0);
1100
1101   u32 w0[4];
1102
1103   w0[0] = pws[gid].i[ 0];
1104   w0[1] = pws[gid].i[ 1];
1105   w0[2] = pws[gid].i[ 2];
1106   w0[3] = pws[gid].i[ 3];
1107
1108   u32 w1[4];
1109
1110   w1[0] = pws[gid].i[ 4];
1111   w1[1] = pws[gid].i[ 5];
1112   w1[2] = pws[gid].i[ 6];
1113   w1[3] = pws[gid].i[ 7];
1114
1115   u32 w2[4];
1116
1117   w2[0] = pws[gid].i[ 8];
1118   w2[1] = pws[gid].i[ 9];
1119   w2[2] = pws[gid].i[10];
1120   w2[3] = pws[gid].i[11];
1121
1122   u32 w3[4];
1123
1124   w3[0] = pws[gid].i[12];
1125   w3[1] = pws[gid].i[13];
1126   w3[2] = pws[gid].i[14];
1127   w3[3] = pws[gid].i[15];
1128
1129   const u32 pw_len = pws[gid].pw_len;
1130
1131   /**
1132    * bin2asc table
1133    */
1134
1135   __local u32 l_bin2asc[256];
1136
1137   const u32 lid4 = lid * 4;
1138
1139   const u32 lid40 = lid4 + 0;
1140   const u32 lid41 = lid4 + 1;
1141   const u32 lid42 = lid4 + 2;
1142   const u32 lid43 = lid4 + 3;
1143
1144   const u32 v400 = (lid40 >> 0) & 15;
1145   const u32 v401 = (lid40 >> 4) & 15;
1146   const u32 v410 = (lid41 >> 0) & 15;
1147   const u32 v411 = (lid41 >> 4) & 15;
1148   const u32 v420 = (lid42 >> 0) & 15;
1149   const u32 v421 = (lid42 >> 4) & 15;
1150   const u32 v430 = (lid43 >> 0) & 15;
1151   const u32 v431 = (lid43 >> 4) & 15;
1152
1153   l_bin2asc[lid40] = ((v400 < 10) ? '0' + v400 : 'a' - 10 + v400) << 8
1154                    | ((v401 < 10) ? '0' + v401 : 'a' - 10 + v401) << 0;
1155   l_bin2asc[lid41] = ((v410 < 10) ? '0' + v410 : 'a' - 10 + v410) << 8
1156                    | ((v411 < 10) ? '0' + v411 : 'a' - 10 + v411) << 0;
1157   l_bin2asc[lid42] = ((v420 < 10) ? '0' + v420 : 'a' - 10 + v420) << 8
1158                    | ((v421 < 10) ? '0' + v421 : 'a' - 10 + v421) << 0;
1159   l_bin2asc[lid43] = ((v430 < 10) ? '0' + v430 : 'a' - 10 + v430) << 8
1160                    | ((v431 < 10) ? '0' + v431 : 'a' - 10 + v431) << 0;
1161
1162   barrier (CLK_LOCAL_MEM_FENCE);
1163
1164   if (gid >= gid_max) return;
1165
1166   /**
1167    * main
1168    */
1169
1170   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, l_bin2asc);
1171 }