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