Replace the substring GPU to a more appropriate "device" or "kernel" substring depend...
[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 __attribute__((reqd_work_group_size (64, 1, 1))) 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
493   /**
494    * modifier
495    */
496
497   const u32 lid = get_local_id (0);
498
499
500   u32 w0[4];
501
502   w0[0] = pws[gid].i[ 0];
503   w0[1] = pws[gid].i[ 1];
504   w0[2] = pws[gid].i[ 2];
505   w0[3] = pws[gid].i[ 3];
506
507   u32 w1[4];
508
509   w1[0] = 0;
510   w1[1] = 0;
511   w1[2] = 0;
512   w1[3] = 0;
513
514   u32 w2[4];
515
516   w2[0] = 0;
517   w2[1] = 0;
518   w2[2] = 0;
519   w2[3] = 0;
520
521   u32 w3[4];
522
523   w3[0] = 0;
524   w3[1] = 0;
525   w3[2] = pws[gid].i[14];
526   w3[3] = 0;
527
528   const u32 pw_len = pws[gid].pw_len;
529
530   /**
531    * bin2asc table
532    */
533
534   __local u32 l_bin2asc[256];
535
536   const u32 lid4 = lid * 4;
537
538   const u32 lid40 = lid4 + 0;
539   const u32 lid41 = lid4 + 1;
540   const u32 lid42 = lid4 + 2;
541   const u32 lid43 = lid4 + 3;
542
543   const u32 v400 = (lid40 >> 0) & 15;
544   const u32 v401 = (lid40 >> 4) & 15;
545   const u32 v410 = (lid41 >> 0) & 15;
546   const u32 v411 = (lid41 >> 4) & 15;
547   const u32 v420 = (lid42 >> 0) & 15;
548   const u32 v421 = (lid42 >> 4) & 15;
549   const u32 v430 = (lid43 >> 0) & 15;
550   const u32 v431 = (lid43 >> 4) & 15;
551
552   l_bin2asc[lid40] = ((v400 < 10) ? '0' + v400 : 'a' - 10 + v400) << 8
553                    | ((v401 < 10) ? '0' + v401 : 'a' - 10 + v401) << 0;
554   l_bin2asc[lid41] = ((v410 < 10) ? '0' + v410 : 'a' - 10 + v410) << 8
555                    | ((v411 < 10) ? '0' + v411 : 'a' - 10 + v411) << 0;
556   l_bin2asc[lid42] = ((v420 < 10) ? '0' + v420 : 'a' - 10 + v420) << 8
557                    | ((v421 < 10) ? '0' + v421 : 'a' - 10 + v421) << 0;
558   l_bin2asc[lid43] = ((v430 < 10) ? '0' + v430 : 'a' - 10 + v430) << 8
559                    | ((v431 < 10) ? '0' + v431 : 'a' - 10 + v431) << 0;
560
561   barrier (CLK_LOCAL_MEM_FENCE);
562
563   if (gid >= gid_max) return;
564
565   /**
566    * main
567    */
568
569   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);
570 }
571
572 __kernel void __attribute__((reqd_work_group_size (64, 1, 1))) 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)
573 {
574   /**
575    * base
576    */
577
578   const u32 gid = get_global_id (0);
579
580   /**
581    * modifier
582    */
583
584   const u32 lid = get_local_id (0);
585
586   u32 w0[4];
587
588   w0[0] = pws[gid].i[ 0];
589   w0[1] = pws[gid].i[ 1];
590   w0[2] = pws[gid].i[ 2];
591   w0[3] = pws[gid].i[ 3];
592
593   u32 w1[4];
594
595   w1[0] = pws[gid].i[ 4];
596   w1[1] = pws[gid].i[ 5];
597   w1[2] = pws[gid].i[ 6];
598   w1[3] = pws[gid].i[ 7];
599
600   u32 w2[4];
601
602   w2[0] = 0;
603   w2[1] = 0;
604   w2[2] = 0;
605   w2[3] = 0;
606
607   u32 w3[4];
608
609   w3[0] = 0;
610   w3[1] = 0;
611   w3[2] = pws[gid].i[14];
612   w3[3] = 0;
613
614   const u32 pw_len = pws[gid].pw_len;
615
616   /**
617    * bin2asc table
618    */
619
620   __local u32 l_bin2asc[256];
621
622   const u32 lid4 = lid * 4;
623
624   const u32 lid40 = lid4 + 0;
625   const u32 lid41 = lid4 + 1;
626   const u32 lid42 = lid4 + 2;
627   const u32 lid43 = lid4 + 3;
628
629   const u32 v400 = (lid40 >> 0) & 15;
630   const u32 v401 = (lid40 >> 4) & 15;
631   const u32 v410 = (lid41 >> 0) & 15;
632   const u32 v411 = (lid41 >> 4) & 15;
633   const u32 v420 = (lid42 >> 0) & 15;
634   const u32 v421 = (lid42 >> 4) & 15;
635   const u32 v430 = (lid43 >> 0) & 15;
636   const u32 v431 = (lid43 >> 4) & 15;
637
638   l_bin2asc[lid40] = ((v400 < 10) ? '0' + v400 : 'a' - 10 + v400) << 8
639                    | ((v401 < 10) ? '0' + v401 : 'a' - 10 + v401) << 0;
640   l_bin2asc[lid41] = ((v410 < 10) ? '0' + v410 : 'a' - 10 + v410) << 8
641                    | ((v411 < 10) ? '0' + v411 : 'a' - 10 + v411) << 0;
642   l_bin2asc[lid42] = ((v420 < 10) ? '0' + v420 : 'a' - 10 + v420) << 8
643                    | ((v421 < 10) ? '0' + v421 : 'a' - 10 + v421) << 0;
644   l_bin2asc[lid43] = ((v430 < 10) ? '0' + v430 : 'a' - 10 + v430) << 8
645                    | ((v431 < 10) ? '0' + v431 : 'a' - 10 + v431) << 0;
646
647   barrier (CLK_LOCAL_MEM_FENCE);
648
649   if (gid >= gid_max) return;
650
651   /**
652    * main
653    */
654
655   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);
656 }
657
658 __kernel void __attribute__((reqd_work_group_size (64, 1, 1))) 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)
659 {
660   /**
661    * base
662    */
663
664   const u32 gid = get_global_id (0);
665
666   /**
667    * modifier
668    */
669
670   const u32 lid = get_local_id (0);
671
672   u32 w0[4];
673
674   w0[0] = pws[gid].i[ 0];
675   w0[1] = pws[gid].i[ 1];
676   w0[2] = pws[gid].i[ 2];
677   w0[3] = pws[gid].i[ 3];
678
679   u32 w1[4];
680
681   w1[0] = pws[gid].i[ 4];
682   w1[1] = pws[gid].i[ 5];
683   w1[2] = pws[gid].i[ 6];
684   w1[3] = pws[gid].i[ 7];
685
686   u32 w2[4];
687
688   w2[0] = pws[gid].i[ 8];
689   w2[1] = pws[gid].i[ 9];
690   w2[2] = pws[gid].i[10];
691   w2[3] = pws[gid].i[11];
692
693   u32 w3[4];
694
695   w3[0] = pws[gid].i[12];
696   w3[1] = pws[gid].i[13];
697   w3[2] = pws[gid].i[14];
698   w3[3] = pws[gid].i[15];
699
700   const u32 pw_len = pws[gid].pw_len;
701
702   /**
703    * bin2asc table
704    */
705
706   __local u32 l_bin2asc[256];
707
708   const u32 lid4 = lid * 4;
709
710   const u32 lid40 = lid4 + 0;
711   const u32 lid41 = lid4 + 1;
712   const u32 lid42 = lid4 + 2;
713   const u32 lid43 = lid4 + 3;
714
715   const u32 v400 = (lid40 >> 0) & 15;
716   const u32 v401 = (lid40 >> 4) & 15;
717   const u32 v410 = (lid41 >> 0) & 15;
718   const u32 v411 = (lid41 >> 4) & 15;
719   const u32 v420 = (lid42 >> 0) & 15;
720   const u32 v421 = (lid42 >> 4) & 15;
721   const u32 v430 = (lid43 >> 0) & 15;
722   const u32 v431 = (lid43 >> 4) & 15;
723
724   l_bin2asc[lid40] = ((v400 < 10) ? '0' + v400 : 'a' - 10 + v400) << 8
725                    | ((v401 < 10) ? '0' + v401 : 'a' - 10 + v401) << 0;
726   l_bin2asc[lid41] = ((v410 < 10) ? '0' + v410 : 'a' - 10 + v410) << 8
727                    | ((v411 < 10) ? '0' + v411 : 'a' - 10 + v411) << 0;
728   l_bin2asc[lid42] = ((v420 < 10) ? '0' + v420 : 'a' - 10 + v420) << 8
729                    | ((v421 < 10) ? '0' + v421 : 'a' - 10 + v421) << 0;
730   l_bin2asc[lid43] = ((v430 < 10) ? '0' + v430 : 'a' - 10 + v430) << 8
731                    | ((v431 < 10) ? '0' + v431 : 'a' - 10 + v431) << 0;
732
733   barrier (CLK_LOCAL_MEM_FENCE);
734
735   if (gid >= gid_max) return;
736
737   /**
738    * main
739    */
740
741   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);
742 }
743
744 __kernel void __attribute__((reqd_work_group_size (64, 1, 1))) 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)
745 {
746   /**
747    * base
748    */
749
750   const u32 gid = get_global_id (0);
751
752   /**
753    * modifier
754    */
755
756   const u32 lid = get_local_id (0);
757
758   u32 w0[4];
759
760   w0[0] = pws[gid].i[ 0];
761   w0[1] = pws[gid].i[ 1];
762   w0[2] = pws[gid].i[ 2];
763   w0[3] = pws[gid].i[ 3];
764
765   u32 w1[4];
766
767   w1[0] = 0;
768   w1[1] = 0;
769   w1[2] = 0;
770   w1[3] = 0;
771
772   u32 w2[4];
773
774   w2[0] = 0;
775   w2[1] = 0;
776   w2[2] = 0;
777   w2[3] = 0;
778
779   u32 w3[4];
780
781   w3[0] = 0;
782   w3[1] = 0;
783   w3[2] = pws[gid].i[14];
784   w3[3] = 0;
785
786   const u32 pw_len = pws[gid].pw_len;
787
788   /**
789    * bin2asc table
790    */
791
792   __local u32 l_bin2asc[256];
793
794   const u32 lid4 = lid * 4;
795
796   const u32 lid40 = lid4 + 0;
797   const u32 lid41 = lid4 + 1;
798   const u32 lid42 = lid4 + 2;
799   const u32 lid43 = lid4 + 3;
800
801   const u32 v400 = (lid40 >> 0) & 15;
802   const u32 v401 = (lid40 >> 4) & 15;
803   const u32 v410 = (lid41 >> 0) & 15;
804   const u32 v411 = (lid41 >> 4) & 15;
805   const u32 v420 = (lid42 >> 0) & 15;
806   const u32 v421 = (lid42 >> 4) & 15;
807   const u32 v430 = (lid43 >> 0) & 15;
808   const u32 v431 = (lid43 >> 4) & 15;
809
810   l_bin2asc[lid40] = ((v400 < 10) ? '0' + v400 : 'a' - 10 + v400) << 8
811                    | ((v401 < 10) ? '0' + v401 : 'a' - 10 + v401) << 0;
812   l_bin2asc[lid41] = ((v410 < 10) ? '0' + v410 : 'a' - 10 + v410) << 8
813                    | ((v411 < 10) ? '0' + v411 : 'a' - 10 + v411) << 0;
814   l_bin2asc[lid42] = ((v420 < 10) ? '0' + v420 : 'a' - 10 + v420) << 8
815                    | ((v421 < 10) ? '0' + v421 : 'a' - 10 + v421) << 0;
816   l_bin2asc[lid43] = ((v430 < 10) ? '0' + v430 : 'a' - 10 + v430) << 8
817                    | ((v431 < 10) ? '0' + v431 : 'a' - 10 + v431) << 0;
818
819   barrier (CLK_LOCAL_MEM_FENCE);
820
821   if (gid >= gid_max) return;
822
823   /**
824    * main
825    */
826
827   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);
828 }
829
830 __kernel void __attribute__((reqd_work_group_size (64, 1, 1))) 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)
831 {
832   /**
833    * base
834    */
835
836   const u32 gid = get_global_id (0);
837
838   /**
839    * modifier
840    */
841
842   const u32 lid = get_local_id (0);
843
844   u32 w0[4];
845
846   w0[0] = pws[gid].i[ 0];
847   w0[1] = pws[gid].i[ 1];
848   w0[2] = pws[gid].i[ 2];
849   w0[3] = pws[gid].i[ 3];
850
851   u32 w1[4];
852
853   w1[0] = pws[gid].i[ 4];
854   w1[1] = pws[gid].i[ 5];
855   w1[2] = pws[gid].i[ 6];
856   w1[3] = pws[gid].i[ 7];
857
858   u32 w2[4];
859
860   w2[0] = 0;
861   w2[1] = 0;
862   w2[2] = 0;
863   w2[3] = 0;
864
865   u32 w3[4];
866
867   w3[0] = 0;
868   w3[1] = 0;
869   w3[2] = pws[gid].i[14];
870   w3[3] = 0;
871
872   const u32 pw_len = pws[gid].pw_len;
873
874   /**
875    * bin2asc table
876    */
877
878   __local u32 l_bin2asc[256];
879
880   const u32 lid4 = lid * 4;
881
882   const u32 lid40 = lid4 + 0;
883   const u32 lid41 = lid4 + 1;
884   const u32 lid42 = lid4 + 2;
885   const u32 lid43 = lid4 + 3;
886
887   const u32 v400 = (lid40 >> 0) & 15;
888   const u32 v401 = (lid40 >> 4) & 15;
889   const u32 v410 = (lid41 >> 0) & 15;
890   const u32 v411 = (lid41 >> 4) & 15;
891   const u32 v420 = (lid42 >> 0) & 15;
892   const u32 v421 = (lid42 >> 4) & 15;
893   const u32 v430 = (lid43 >> 0) & 15;
894   const u32 v431 = (lid43 >> 4) & 15;
895
896   l_bin2asc[lid40] = ((v400 < 10) ? '0' + v400 : 'a' - 10 + v400) << 8
897                    | ((v401 < 10) ? '0' + v401 : 'a' - 10 + v401) << 0;
898   l_bin2asc[lid41] = ((v410 < 10) ? '0' + v410 : 'a' - 10 + v410) << 8
899                    | ((v411 < 10) ? '0' + v411 : 'a' - 10 + v411) << 0;
900   l_bin2asc[lid42] = ((v420 < 10) ? '0' + v420 : 'a' - 10 + v420) << 8
901                    | ((v421 < 10) ? '0' + v421 : 'a' - 10 + v421) << 0;
902   l_bin2asc[lid43] = ((v430 < 10) ? '0' + v430 : 'a' - 10 + v430) << 8
903                    | ((v431 < 10) ? '0' + v431 : 'a' - 10 + v431) << 0;
904
905   barrier (CLK_LOCAL_MEM_FENCE);
906
907   if (gid >= gid_max) return;
908
909   /**
910    * main
911    */
912
913   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);
914 }
915
916 __kernel void __attribute__((reqd_work_group_size (64, 1, 1))) 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)
917 {
918   /**
919    * base
920    */
921
922   const u32 gid = get_global_id (0);
923
924   /**
925    * modifier
926    */
927
928   const u32 lid = get_local_id (0);
929
930   u32 w0[4];
931
932   w0[0] = pws[gid].i[ 0];
933   w0[1] = pws[gid].i[ 1];
934   w0[2] = pws[gid].i[ 2];
935   w0[3] = pws[gid].i[ 3];
936
937   u32 w1[4];
938
939   w1[0] = pws[gid].i[ 4];
940   w1[1] = pws[gid].i[ 5];
941   w1[2] = pws[gid].i[ 6];
942   w1[3] = pws[gid].i[ 7];
943
944   u32 w2[4];
945
946   w2[0] = pws[gid].i[ 8];
947   w2[1] = pws[gid].i[ 9];
948   w2[2] = pws[gid].i[10];
949   w2[3] = pws[gid].i[11];
950
951   u32 w3[4];
952
953   w3[0] = pws[gid].i[12];
954   w3[1] = pws[gid].i[13];
955   w3[2] = pws[gid].i[14];
956   w3[3] = pws[gid].i[15];
957
958   const u32 pw_len = pws[gid].pw_len;
959
960   /**
961    * bin2asc table
962    */
963
964   __local u32 l_bin2asc[256];
965
966   const u32 lid4 = lid * 4;
967
968   const u32 lid40 = lid4 + 0;
969   const u32 lid41 = lid4 + 1;
970   const u32 lid42 = lid4 + 2;
971   const u32 lid43 = lid4 + 3;
972
973   const u32 v400 = (lid40 >> 0) & 15;
974   const u32 v401 = (lid40 >> 4) & 15;
975   const u32 v410 = (lid41 >> 0) & 15;
976   const u32 v411 = (lid41 >> 4) & 15;
977   const u32 v420 = (lid42 >> 0) & 15;
978   const u32 v421 = (lid42 >> 4) & 15;
979   const u32 v430 = (lid43 >> 0) & 15;
980   const u32 v431 = (lid43 >> 4) & 15;
981
982   l_bin2asc[lid40] = ((v400 < 10) ? '0' + v400 : 'a' - 10 + v400) << 8
983                    | ((v401 < 10) ? '0' + v401 : 'a' - 10 + v401) << 0;
984   l_bin2asc[lid41] = ((v410 < 10) ? '0' + v410 : 'a' - 10 + v410) << 8
985                    | ((v411 < 10) ? '0' + v411 : 'a' - 10 + v411) << 0;
986   l_bin2asc[lid42] = ((v420 < 10) ? '0' + v420 : 'a' - 10 + v420) << 8
987                    | ((v421 < 10) ? '0' + v421 : 'a' - 10 + v421) << 0;
988   l_bin2asc[lid43] = ((v430 < 10) ? '0' + v430 : 'a' - 10 + v430) << 8
989                    | ((v431 < 10) ? '0' + v431 : 'a' - 10 + v431) << 0;
990
991   barrier (CLK_LOCAL_MEM_FENCE);
992
993   if (gid >= gid_max) return;
994
995   /**
996    * main
997    */
998
999   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);
1000 }