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